How To Get The Element From The Returned Collection Of .childNodes Method
example: function something( ) { var elementObjects = document.getElementById( 'anElement' ); var children = elementObjects.childNodes; // assuming element with id = 'anEle
Solution 1:
a NodeList is similar to an array, but you use .item() to access members:
for (var i = 0; i < myNodeList.length; i++) {
var el = myNodeList.item(i);
....
}
Solution 2:
childNodes returns an array of objects, inorder to access individual element you have iterate through this array and access the elementobjects.
Post a Comment for "How To Get The Element From The Returned Collection Of .childNodes Method"