Skip to content

Making selector aware

When using to interact with data-attributes selecting elements with that attribute will not work. jQuery('.selector').data('name'); reads the data-name="foobar" attribute from a DOMElement. This attribute could be used in a selector, say jQuery('[data-name="foobar"]').hide(). But if you use to set or update such an attribute, your selector would fail.

Continue reading "Making selector aware"