I’m trying to see if a list item with a certain attribute value does not exist. This code will help me find items with a certain attribute, but how do I modify it to check if there isn’t a list item with that attribute set to a certain value? For example, if item with someAttributeName = exist does not exist, then…
$(parentElement).find('*[someAttributeName]').each(function(index){
doSomething(this); });
This will return all elements that don’t have an attribute with a specific value. See the jQuery Not Equals Selector for more details.