Search code examples
yui

Using wilcard for Data Attributes with YUI3


I have to use YUI3 for this particular project. Yes i know YUI is dead.

How does one return a number of notes based on the data attributes wildcard?

E.g.

Y.all('[data-test="*"]').size() > 0

I've set up a JSBin if you need a further example: http://jsbin.com/hupip/edit


Solution

  • Can you not use:

    Y.all('[data-target]');
    

    ?

    This should select all elements with data-target attribute regardless of its value, the code you posted would select elements with an empty value