I came across a year code written by a good developer (yes, I knew it personally) to get access to all elements that have the same identifier.
$("#choice,#choice")
It returns all elements with an identifier. But if we use below
$("#choice")
It returns only the first match, as expected.
After searching for some time, I cannot find any official links pointing to his technique regarding how he selected all the elements with a duplicate identifier.
Can someone explain how this works?
UPDATE
Please see the question is not about which alternative to use. I know the Selectors and attributeSelectors class and I know that duplicating IDs is not recommended, but sometimes you just need to live with the summer code as it is (if you know what I mean).
http://jsbin.com/zodeyexigo/1/edit?html,js,output
javascript jquery html html5 jquery-selectors
coding_idiot
source share