How can I target all elements with same ID or class name at once?

Is it safe to give several elements the same ID on one page? For example, this often happens, when using some jquery plugins, when you run some slider or gallery twice or more. We know, developers like to give some ID to the Html container in order for the script works faster.

You should not have duplicate id values.

Just for next time, when you’re trying to share code that includes HTML and JS and CSS, it would be really helpful to everyone if you put that code somewhere like on CodePen.

2 Likes

noted, thank you!

from now on I’ll do that.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.