I have an old project that does contain HTML with duplicate IDs. Switching selectors from ids to classes needs a lot of work, Can I do it with the JQuery, specially that I know how many divs I’ll hide.
<div id="d"></div>
<div id="d"></div>
<div id="d"></div>
I want to hide them all using a single action :
$('#d').hide();
but it hides the first div only.
You hid by id, which won’t work as you have non-unique ids. Add a data-* attribute to them or a class as a flag.
Due to your edit:
I’m not sure if the ids are wiped after the first one since they are duplicated, but if they’re not, this should work.