I support a sophisticated web application.
I have a large number of divs that have the same ID .
I know that this is completely wrong, and essentially document.getElementById() with this id will produce only one match for me.
However, I can pull out the element I'm looking for using jQuery (we are on 1.6.2), for example: $('#bad_id[nonstandard_attr_name=somethingSpecific]')
Not quite ready to say that this is a "solution."
I worry about whether it is reliable or not. Is jQuery really collecting a search for all elements matching an ID using a DOM walk? This is probably the only way to get all of them.
First, it filters the elements by a different attribute, and then filters it by identifier? It would also provide the desired behavior, but it would be nice to know the order in which he does it.
source share