JavaScript

jquery find div with data attribute

How to find an element with data attribute by selector and add an event to them in jQuery?

For example, we have html page which contains many divs at different knots. Some of them have an attribute data-custom. How can these divs be identified in JQuery to add onClick event to them? In jQuery documentation we have this example: But with it we can find attributes with a value in search. If you want …

How to find an element with data attribute by selector and add an event to them in jQuery? Read More »