I have the current html:
<input id="dynamic1" /* other */ data-group-animal="y1,y2" />
<input id="dynamic2" /* other */ data-group-vegetable="y3,y4" />
These are independent divs that can be use together or not when sending data via ajax.
Now, one option i have is to use both fields and i need to retrieve the data-value for both based on some form options. the data attribute is different (is used for different purposes — I can send or not all the groups or separately)
so I want to do:
$('input').data('group*') but it does not work, then I realize I need a regexp.
is there a regexp for data attribute i can use?
You could use selectors if you change your attributes.
http://jsfiddle.net/kvJVM/1/
So, you could have instead a
data-group-typeand query for that:Some example queries
There are other selectors: http://api.jquery.com/category/selectors/