I’m making a site, and the html is displayed through php with data fetched from a database.
I have a foreach() function, so all of the things displayed have the same DIV ID’s.
It ends up being like 4 DIVs with the same ID (#content), so the PHP works fine, but I have a jQuery script and when I call the jQuery("#content").hide(); it only hides ONE of the DIV’s not all of them, and I want it to hide all of them. Is there something else I have to do?
Thanks.
I’m making a site, and the html is displayed through php with data fetched
Share
You should use a class (
.class_name), not an id–only one DOM element may have a given ID, otherwise it’s invalid HTML. It’s reasonable for an ID selector to return only a single element.