E
Edgardo R. Del Rosario
Is there a function in JavaScript to get the list of the values for all
the 'id' attributes in an HTML page?
the 'id' attributes in an HTML page?
Is there a function in JavaScript to get the list of the values for all
the 'id' attributes in an HTML page?
Edgardo said:Is there a function in JavaScript to get the list of the values for all
the 'id' attributes in an HTML page?
Thomas said:[...]
Or, suppose you are dealing with invalid markup where duplicate IDs may occur:
var e, ids = new Object(), list = [];
while ((e = elemsWithId.iterateNext())
{
ids[e.id] = true;
}
for (var id in list)
No.
You will have to sift through the elements on the page and find those
that have an id attribute with an appropriate value, e.g. where the id
attribute value has a length other than zero, something like:
if (element.id && element.id.length > 0)
Thank you everybody... great suggestions! let me try them and I mightEdgardo said:Is there a function in JavaScript to get the list of the values for all
the 'id' attributes in an HTML page?
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.