jQuery: Selecting all elements where attribute is greater than a value
Solution 1:
You can do this using the function overload of .filter()
, like this:
.filter(function() {
return $(this).attr("attrName") > "someValue";
})
Solution 2:
Be careful, if you are playing with integers make sure you are using parseInt()
.
$("selector").filter(function() {
return parseInt($(this).attr("my-attr")) > 123;
});