Reputation: 916
In php, I can use getElementsByTagName on any DOM object but it seems JavaScript does not have that concept.
IE if the var detailsNode is a specific node, detailsNode.getElementsByTagName('summary') does not seem to work, firebug error says detailsNode.getElementsByTagName is not a function.
So, how do I target getElementsByTagName() to only look within a specified DOM element in JavaScript?
Thank you for suggestions.
Oh, and the answer needs to be straight up DOM2 method, no jQuery for this (where it would be easy).
Upvotes: 1
Views: 612
Reputation: 2610
Element and Node objects do have getElementsByTagName which returns an array of the found elements in the given Element/Node.
Upvotes: 2