We start with a div tag with an attribute
<div atr="1">a</div>
I have not found an operator for this case, I want to know if the attribute is greater than X . To add the class disabled. X is any number example 5.
$("div [atr<='X']").addClass('disabled');
The not equals operator does not work for me because there are several that should not be disabled and several that should.
You can't use those operators inside a selector. You could do something like this:
@MikelFerreiro 's answer is correct, but you could optimize and simplify the code further using:
$("div[atr]")
: to search for only those elements that have the attributeatr
, otherwise you would be searching for ALLdiv
on the page.chaining
to apply.addClass
to the result.demo