I have a HTML file that has code similar to the following.
<table>
<tr>
<td id="MyCell">Hello World</td>
</tr>
</table>
I am using javascript like the following to get the value
document.getElementById(cell2.Element.id).innerText
This returns the text "Hello World" with only 1 space between hello and world. I MUST kee...
I have this HTML structure and want to convert it to an accordion.
<div class="accor">
<div class="section">
<h3>Sub section</h3>
<p>Sub section text</p>
</div>
<div class="section">
<h3>Sub section</h3>
<p>Sub section text</p>
</div>
<div class="section">
<h3>Sub section</h3>
...
According to spec, only the BODY and FRAMESET elements provide an "onload" event to attach to, but I would like to know when a dynamically-created DOM element has been added to the DOM in JavaScript.
The super-naive heuristics I am currently using, which work, are as follows:
Traverse the parentNode property of the element back until ...
I have an HTML input box
<input type="text" id="foo" value="bar">
I've attached a handler for the 'keyup' event, but if I retrieve the current value of the input box during the event handler, I get the value as it was, and not as it will be!
I've tried picking up 'keypress' and 'change' events, same problem.
I'm sure this is simple...
Before I get into the details of this problem, I'd like to make the situation clear. Our web analytics company works as a consultant for large sites, and (other than adding a single SCRIPT tag) we have no control over the pages themselves.
Our existing script installs handlers using "old" way (a fancy version of element.onclick = blah; ...
I've implemented a set of draggable elements that can be dropped into some containers using jQuery. What I need is an animation that moves an element to a specific container without user interaction. The problem is that the elements and the drop containers are in completely different parts of the DOM and mostly positioned using float.
A...
I'm writing a GreaseMonkey script where I'm iterating through a bunch of elements. For each element, I need a string ID that I can use to reference that element later. The element itself doesn't have an id attribute, and I can't modify the original document to give it one (although I can make DOM changes in my script). I can't store the ...
I want to use the php simple HTML DOM parser to grab the image, title, date, and description from each article on a page full of articles. When looking at the API I notice it has a set_callback which Sets a callback function. However im not sure what this does or how I would use it? In one of the examples its used to call a function whic...
For the moment the best way that I have found to be able to manipulate DOM from a string that contain HTML is:
WebBrowser webControl = new WebBrowser();
webControl.DocumentText = html;
HtmlDocument doc = webControl.Document;
There are two problems:
Requires the WebBrowser object!
This can't be used with multiple threads; I need som...
For instance in the snippet below - how do I access the h1 element knowing the ID of parent element (header-inner div)?
<div id='header-inner'>
<div class='titlewrapper'>
<h1 class='title'>
Some text I want to change
</h1>
</div>
</div>
Thanks!
...
I've got a DOMNode object that has some attributes. $Node->attributes is a DOMNamedNodeMap, which has no methods for removing one of the entries in the map. The DOMNode class also has no methods for removing attributes from an element. I've looked through a number of the other related classes and none of them seem to provide a mechani...
I'm using IXMLDOM in MSXML 6 to build an XML file in a C++ MFC application. Is there a way to see the contents of the xml document while it is in memory?
For example, an XPATH query is failing about halfway through creating the file. How would I view the entire contents of the xml doc?
Thanks!
...
I'm wanting to add a class to the body tag without waiting for the DOM to load, but I'm wanting to know if the following approach would be valid. I'm more concerned with validity than whether the browsers support it for now.
<body>
$("body").addClass("active");
...
</body>
Thanks,
Steve
...
If I had the following select, and did not know the value to use to select an item in advance like in this question or the index of the item I wanted selected, how could I select one of the options with jQuery if I did know the text value like Option C?
<select id='list'>
<option value='45'>Option A</option>
<option value='23'>Option B<...
The Situation
I have an area of the screen that can be shown and hidden via JavaScript (something like "show/hide advanced search options"). Inside this area there are form elements (select, checkbox, etc). For users using assistive technology like a screen-reader (in this case JAWS), we need to link these form elements with a label or ...
I've found that given a form in a HTML page like this:
<form name="form">
<input type="image" name="foo"
src="somewhere.gif" alt="image" value="blah"/>
<input type="text" name="bar" value="blah"/>
</form>
When accessing the elements via the DOM in Javascript, there is no element for the image input! It is just omitte...
Hi,
I have the following HTML node structure:
<div id="foo">
<div id="bar"></div>
<div id="baz">
<div id="biz">
</div>
<span><span>
</div>
How do I count the number of immediate children of "foo", that are of type "div". In the example above, the result should be two ("bar" and "baz").
Cheers,
Don
...
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, but the element itself could be a div, a form field, a fieldset, etc. Can anyone tell me how to do this?
...
The situation is somewhat like-
var someVar;
someVar = some_other_function();
someObj.addEventListener("click",
function(){
some_function(someVar);
},
false);
The problem is that the value of someVar is not visible inside the listener...
I have several identical elements with different attributes that I'm accessing with SimpleXML:
<data>
<seg id="A1"/>
<seg id="A5"/>
<seg id="A12"/>
<seg id="A29"/>
<seg id="A30"/>
</data>
I need to remove a specific seg element, with an id of "A12", how can I do this? I've tried looping through the seg elements an...