Is it possible to select all items that do not match a selector?

advertisements

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();
    }
});

Is 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.