I have the following HTML select element:
<select id="leaveCode" name="leaveCode">
<option value="10">Annual Leave</option>
<option value="11">Medical Leave</option>
<option value="14">Long Service</option>
<option value="17">Leave Without Pay</option>
</select>
Using a javascript function with the ... |
I feel like this should be really easy to do, but I'm stumped. I need a way for Javascript to determine the type of an HTML element. It has the id, ... |
This is not to be confused with "How to tell if a DOM element is visible?"
I want to determine if a given DOM element is visible on the page.
E.g. if ... |
//EDIT My issue was related to something else, I thought the implementation was incorrect but it actually works, thanks for the confirmation.
Looked in jQuery and prototypejs, can't seem to find the ... |
How do I get the next element in html using javascript?
Suppose I have three divs and I get a reference to one in js code, I want to get which is ... |
Is there any way to find out that how many elements are going to be loaded in a webpage via javascript?
for example, I'm going to show the visitor something ... |
I'm wondering if there's a way to count lines inside a div for example. Say we have a div like so:
<div id="content">hello how are you?</div>
Depending on many factors, the div can ... |
|
I'd love it if I could make my own class that extended an HTML element class, e.g. HTMLDivElement or HTMLImageElement.
Assuming the standard inheritance pattern:
// class A:
function ClassA(foo) {
...
|
to debug some javascript code, I am looking for javascript code (preferably just js, without libraries and dependencies) that can highlight a div or span (probably by putting over it a ... |
I want to associate a javascript object with an HTML element. Is there a simple way to do this.
I noticed in the HTML DOM (http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html) defines a setAttribute method ... |
Hi
I am using this code snippet to add KeyDown event handler to any element in the html form
for(var i=0;i<ele.length;i++)
{
ele[i].onkeydown = function()
{
...
|
I have a complex input form within a PHP based web application. To structure it a bit, I introduced "Multifaceted lightbox" to let parts of the form - named ... |
Imagine I have the following HTML:
<div><span><b>This is in bold</b></span></div>
I want to get the HTML for the div, including the div itself. Element.innerHTML only returns:
<span>...</span>
Any ideas? Thanks
|
I have about 100 <span class="foo">, 100 <span class="bar"> and 100 <span class="baz"> tags in my document. I need to implement the following operations in JavaScript:
- Change the background all foos to ...
|
I want add element with JS.
I have code:
var collection = document.getElementsByTagName('body');
var a = document.createElement('div');
a.innerHTML = 'some text';
...
|
When using ECMAScripts typeof on plugin elements (i.e. embed or object), Safari & FireFox return "function":
typeof(window.document['myPlugin']) // "function"
This can't be influenced on the plugin side, as the browser doesn't call the ... |
I need to identify all html elements on a page in a browser agnostic fashion. What I am basically doing is using mouse events to record clicks on the page. ... |
I have HTML page with some HTML element with ID="logo". I need to create JS script (with no external libs calls) that will overwrite that html element with other HTML element ... |
I have to make a custom function for search/replace text, because firefox counts text nodes differently than IE, Google Chrome, etc..
I am trying to use this code, that I saw at ... |
Does someone knows how can I change the container for my drop down box?
I have 3 "TD" tags and I would like to move the drop down between them, using client ... |
My main question is to calculate the last alert message, but any other information is also welcome.
I am trying to learn javascript (to use with greasemonkey later), but I am struggling ... |
I am using classic Javascript for DOM scripting, i have a set of DIV's in a container DIV.
On click event of child DIV's, i want that the child DIV which has ... |
I sometimes need to add elements (such as a new link and image) to an existing HTML page, but I only have access to a small portion of the page far ... |
I started working on an experimental project tonight. I've realized that I need to determine if a group of selected nodes are self closing or not.
For example, suppose I query the ... |
Besides of the ID, if you say, you want a unique identifier for an HTML element (let say a div).
I browsed the DOM for something (like a number or string) that ... |
Is there a way to create your own HTML element? I want to make a specially designed check box.
I imagine such a thing would be done in JavaScript. Something akin to ... |
I'm trying to store a reference of an HTML tag for later reuse.
e.g. If I click on a div and save a pointer to that div within Javascript, will there be ... |
I'm trying to create a continually rotating banner for the top of the homepage of a site I'm developing. The best way that I can figure to keep it constantly in ... |
So, if I have HTML like this:
<div id='div'>
<a>Link</a>
<span>text</span>
</div>
How can I use JavaScript to add an HTML element where that blank line is?
|
I'm trying to find the location of an element on the screen using javascript. This is what I'm doing.
function locateTargets(){
var targets = document.getElementsByTagName("span");
for(var ...
|
Using javascript, how do I get all DOM elements that start with a certain prefix like <prefix:suffix>
Code example:
<div>
<foo:bar1>hello</foo:bar1>
</div>
<foo:bar2>world</foo:bar2>
But, without looping through ALL elements (for performance reasons)?
Thanks, Ran
... |
Example:
<script>
// I want to have the dom element of the script tag that is holding the code that goes here
</script>
If I do:
<script>
alert(this)
</script>
this is the window.
I want to access the script tag ... |
I have the following HTML:
<html>
<head><title>Title</title></head>
<body>
<div id='div2'>
<a href='#'>1</a>
<div id='div1'>
...
|
I want to search a webpage for elements by tag name such a <p> or <body> or by class id and then highlight them. I want to do this using 3 ... |
I'm showing a popup as a fixed div in random websites.
I need the content of the div to not be effected by the formatting of the page it resides in. ... |
I have a list with enabled and disabled option. I do know how to disable an option element but what I don't know how to enable it again.
<select size="1" id="x">
...
|
I have a page with a hidden form containing several divs.
<form action="...">
<div>
<input id="menubar_open_article_bid" name="bid" onfocus="this.select();" onkeyup="do_v(); type="text">
...
|
I have a form like this:
<form action="/cgi-bin/cgi_info.py" method="POST">
<select id="faults" class="multiselect" multiple="multiple" name="faults[]">
<option>Big nose
<option>Big feet
<option>Wrinkly nose
...
|
Is it possible to determine when a dom element has come into view ?
I would like an event to be raised when an element (e.g div, image) has come into the ... |
How can I place the caret (collapsed range) inside an empty element node. This code is supposed to work, but it doesnt.
node = document.getElementById('some-empty-strong-node')
range = document.createRange()
range.selectNodeContents(node)
window.getSelection().addRange(range)
Trying other tricks like adding an ... |
I am developing a online website design system like yola.com.
I want to get a list of applied CSS properties with their values to any DOM element.
For example, I have ... |
I don't know what it's called, but I know that there's a way to get elements based on their tags without getElementsByTagName. It returns the same thing, but it's shorter and ... |
if a whole bunch of elements gets generated in my browser by javascript (using JSON data or just out of thin air) I am not able to fully archive such a ... |
I am building a one page webapp and it's starting to get pretty big. There are several components to the app, each one meticulously styled. On average the app has a ... |
I've got some elements in the DOM that are being made visible by some javascript, but I can't find what javascript is affecting those elements? Like you can use firebug/chrome to ... |
i have some code which takes in a html using ajax and after which it's meta tags are retrieved.
if (request.readyState == 4) {
var html_text = request.responseText; ...
|
I would like to do something like:
var htmlcode = '<div>testing</div>';
document.getElementById('initDiv').html = htmlcode;
kinda like using innerHTML but replacing the element itself.
Can someone help me please?
thanks
|
I don't know exactly how to post this question, so, please, bare with me:
I am writing something academic where I have namespaced html elements like:
<ns:LinkList id="sitesuteis" cssClass="classone">
...
|
I have a form with multiple text input fields and sub-forms. Is there a way to access everything based on how it appears in the DOM tree?
In other words, if I ... |
Is there a vanilla JavaScript cross-browser function available that is able to trigger a click event on a DOM element (including non-form elements)?
|
Is there a way to find out if an element is obscured by another element that is not a child of the first one? Because I have a menu that I ... |
object.innerHTML = "<div class='panel'>foo |</div>"
or
panel = document.createElement ("div");
panel.setAttribute ("class", "panel");
panel.innerHTML = "foo |";
object.appendChild (panel);
Say I'm creating a lot of divs on the fly (around a hundred or so), each with ... |
|
In JavaScript, how can I get the first and last words from an element's text?
For example:
<div class="content">this is a test</div>// output 'this' 'test'
<p>This is another test</p>// output 'this' 'test'
How can ... |
I am creating a website of floating width. The users use screens from full HD resolution to some 600px on smart phones it seems a pretty good idea. This brings up ... |
I am trying to add an img to the placehere div using JavaScript, however I am having no luck. Can anyone give me a hand with my code?
<html>
<script type="text/javascript">
var elem = ...
|
How do I call the td element of a html table from the dom? document.getElementById("exampleTable").childNodes[] Should give you all of the tr elements, but how do you go two levels down? ... |
I'm working on a firefox extension and one of the things I need to do is adding an element to the dom. I have no problem with this, except that I ... |
I am using mootools-more.1817.js...this is my HTML structure:
<ul id="categories">
<div id="admin">Admin Controls</div>
<li class="selected"><a href="#">Test</a>
<ul>
...
|
function addPrivate() { var root = document.getElementById('registration'); var label1 = document.createElement('label'); label1.appendChild(document.createTextNode('First Name: ')); var label2 = document.createElement('label'); label2.appendChild(document.createTextNode('Last Name: ')); var label3 = document.createElement('label'); label3.appendChild(document.createTextNode('Address*: ')); var label4 = document.createElement('label'); label4.appendChild(document.createTextNode('Profession: ')); var div = document.createElement('div'); var input1 = createElement('input'); input1.type='text'; input1.name='fname'; var input2 = createElement('input'); input2.type='text'; input2.name='lname'; var input3 = createElement('input'); input3.type='text'; input3.name='address'; var input4 = createElement('input'); input4.type='text'; input4.name='profession'; ... |
__________________ Three gigs for the secretaries fair Seven gigs for the system source Nine gigs for the coders in smoky lairs One disk to rule them all, one disk to bind them One disk to hold the files, and in the darkness grind'em --------------------------------------------------- It is by caffeine alone that I set my mind in motion. It is by the beans ... |
|
Hello, In both Firefox and Netscape. If I create an external css ref using document.createElement('link'); (I also set the rel,type, and href props) the elements it specified in the external.css with a width of 100% and a height of 100% no longer give the proper clientWidth and clientHeight reading. Instead clientWidth and clientHeight match that of offsetWidth and offsetHeight (which doesnt ... |