jQuery call same on click function of elements having same ids

You cannot have multiple ID’s in your HTML markup.

It would be an invalid markup. When querying for $(‘#foobar’) and there are five elements which have that id, you would only get the first instance. So even if there would be a way (…) to apply code to all of those nodes, don’t do it.

Use Classnames when you want to “combine” some elements.

By Keenlio, February 17, 2014

One Comment

  1. keenlio says:

    Stack overflow, there has many good reply.
    Cheers!

What do you think?

Leave a Reply

Your email address will not be published. Required fields are marked *


6 × eight =

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>