I have a table with lots of rows.
I would like to select all rows that does not match some selector.
For example:
$('#my_table tr').each(function() {
if ($(this).find(".class_a.class_b[my_param='" + my_value + "']").length > 0) {
$(this).do_something();
}
});
I开发者_运维百科s that possible to do the same in easier way ?
Have a look at jQuery's :not()
-selector. It excludes elements from the current selection set.
$('#my_table tr').not('.class_a').each(function(){
// do something
}
);
the above code will select all rows that are in table with ID='my_table' and whose classname is not 'class_a' . Is this what you needed ?
精彩评论