How can I find all elements without a certain data-attribute?
I've tried:
$list.find('li:not([data-stuff])');
But it doesn't work.
jQuery stores data
attributes in its cache, so you need to use filter:
var $li = $list.filter(function() {
return $(this).data('stuff') != undefined;
});
// do something with $li...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With