jQuery attribute name contains -
i'm trying target attributes names contains word & not in kind of way you're thinking.
lets have:
<div data-foo-bar="hello"></div>
how can target elements have 'data-foo'
in attribute name?
i don't think can target attribute names same way target attribute values. can, however, use .filter()
efficiently:
$('div').filter(function() { (var property in $(this).data()) { if (property.indexof('foobar') == 0) { return true; } } return false; });
notice data-foo-bar
has been converted foobar
.
Comments
Post a Comment