And multiple other divs with similar structure, id="2", "3" etc, I want to access the <p> tags to change style-- so that, for example, the last paragraph in all of the divs would change.
To access the last paragraph, I've tried:
Code:
--which generates an error message that the function itself is undefined.
There's till something I'm not understanding about using node-seekers with classes of tags. But if I can get it right, it saves giving each of the <p> tags a class, which would be easier, but code-heavy.
I'm loading an xml data file and then trying to take a particular node and add it, as html, to an element on my page using inner HTML. The xml is like what is below, with the . Code:
When calling remove on a selector, I understand that events & data are removed from the matched elements. What about children of these nodes, is the same true?
I am trying to remove a child node from an XML document and running into issues. I keep getting errors about not being able to find the child node, even though it very clearly exists.I think the issue is that most examples I've tried to follow only have the root element, then the nodes, but I have a root element, then another level (mapSettings & mapObjects). I don't know how to tell the remove child command that it needs to look in the mapObjects section.
I keep on getting a error message from internet explorer whenever I try to remove a node from the document. This code obviously works on every other browser but internet explorer. What am I doing wrong here?
var elem = document.getElementsByTagName("div")[2]; elem.removeChild(document.getElementById("loginContent")); elem.removeChild(document.getElementById("loginContainerLayer"));
Why are anchor nodes pointing to href and text nodes pointing to [object]? As anchor and text both are objects therefore all outputs from indices 0 to 7 should be [object].
I'm trying to iterate through nodes in a Selection Range, but I'm having a bit of trouble determining why all nodes in the range aren't being hit. It seems like deeply nested nodes aren't being hit for some reason.
Here's the code I'm using.
var n = startNode; while (n) { this.visited.push('[' + n.nodeName + ']');
if (n == endNode) { break; }
if (n != startNode && n.hasChildNodes()) { n = n.firstChild; } else { while (!n.nextSibling) { n = n.parentNode; } n = n.nextSibling; } }
I want to remove a specific box when i click on the remove button in that box. I have a lot of boxes on a page but when i click on the remove btn it removes all the boxes. I just want to remove the box where i click on the delete btn.
This is the js code: $(".del").click(function() { $('div.floating-box').remove(); });
With a HTML UL I have ul inside ul but all I want to get when I select a certain list is the children of that list but remove the ul inside that list so they dont show at all [url], current selecting code is [url]
There doesn't seem to be any mechanism to "clear" a node of all it's children (not that its necessary very often, but I have come across situations where I'd like to clear a node of all it's children before appending other nodes). I've come up with two possibilities: Code:
I try to associate DOM nodes with other objects. Assigning custom properties to DOM nodes works in Firefox and Safari. It also works with HTML nodes in IE6. However, it appears not to work with XML nodes that are part of trees returned by XMLHttpRequest. How can I work around this limitation? For XML nodes, I need to be able to associate at most one object with each node.
The syntax I am using is node.customproperty = value
I must be missing something very obvious, but my nightly head doesn't work anymore.
Press "Insert" button to add <insnodes after each <br>. Now press "Delete" - only even <insare being removed. ins.length is reported properly, each <inshas "insert" class name. What a...?
I'm sure I'm missing something basic, but I can't seem to find what I'm looking for. If I have an xml doc where the parent node and child nodes contain elements with the same name ("name" in this case), how would I go about just getting the client's name? Here is a slimmed down version of the structure:
function Xml_feed(file) { this.load = function() { var txt, str, title; var threads = xml.getElementsByTagName('thread'); var len = threads.length; var box = document.getElementById('box-a'); while (len-->0) { txt = document.createElement('button'); title = threads[len].getElementsByTagName('title'); str = threads[len].getElementsByTagName('author'); txt.setAttribute('label', title[0].childNodes[0].nodeValue + ' by ' + str[0].childNodes[0].nodeValue); box.appendChild(txt); } };
var xml = document.implementation.createDocument("","",null); xml.onload = this.load; try { xml.load(file); } catch (e) { alert('There was a problem loading the XML file'); } } var feed = new Xml_feed('blah.xml');
in the red:
Is that how I should be retrieving the value from a child node? (the getElementsByTagName)..
in the blue:
I tried doing this.xml but had problems with doing that, i.e, this.xml = document.implementation.createDocument("","",null); this.xml.onload = this.xml.load; try { this.xml.load(file); } catch (e) { alert('There was a problem loading the XML file'); } I'll guess that text in the red is why.. btw, this was in an XUL app.. not sure how much that would matter though..
I have a bunch of numbers on my page, wrapped in a particular HTML element e.g. <h2>5</h2>, <h2>1</h2>, <h2>3</h3>
I am looking for a javascript function that can add these numbers together. The tricky thing is that I do not know how many numbers there might be - anything from 0 to 7.
If necessary, I can give each of the <h2>'s a unique class eg. <h2 class="a">5</h2>, <h2 class="b">1</h2> etc.