Hi,
Is it possible to use GetElementsByTagName for grandchild elements? I have a div with a bunch of lis nested inside of the div, and a hidden input field inside of each li. The lis are draggable, and I want to write a script that adds up the values inside each of the input fields.
Here is what my HTML looks like:
<div>
<li>
<input type="hidden" value="x" />
</li>
<li>
<input type="hidden" value="x" />
</li>
<li>
<input type="hidden" value="x" />
</li>
</div>
The Javascript looks like this, but Firebug is telling me that x.getElementsByTagName('input') has no properties:
var div = document.getElementById(semester);
var li = div.getElementsByTagName('li')[1]; // 1 hard-coded in, would normally be inside a loop.
alert(li.getElementsByTagName('input')); // This is the problematic line.
I would greatly appreciate any help you can give.
Thanks,
Zach