Skip to content Skip to sidebar Skip to footer

Jquery Find Div Attribute Smaller Or Higher

i want to find all div attributed value matched smaller or higher numeric value. its worked me only eq value=444 (example div[ref=444],[ref=333]....) var $filteredData = $data.fin

Solution 1:

Yes, attributes are strings, there is no selector to treat them as numbers. You would have to parse and filter manually:

$filteredData= $data.find('div').filter(function() {
    returnparseInt($(this).attr('ref'), 10)<444;
});

(But what's ref? If this is HTML content, that's not a standard attribute. Avoid custom HTML attributes; if you must use them, use HTML5 data- attributes. But other methods, such as putting the information in a className, might be better, depending on what you're doing.)

Post a Comment for "Jquery Find Div Attribute Smaller Or Higher"