evan evan - 1 year ago 86
HTML Question

Add data-action to all img that contain a class

I'm using this plugin: https://github.com/fat/zoom.js/

I'd like to select all

that have the class
and add
to the element. Is this possible using jQuery? Is the performance going to be really poor?

Answer Source

Use jQuery.data( key, value ) method


Or using jQuery.attr( attributeName, value ),

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download