Filter Items Out Using Not Logic

$("div").not(".menu");   //selects <div> element; do not have class .menu $("option").not(function(){   return (this.value==0); }); });   //selects <option> elements that do not have value=0

The .not(filter) method reduces the set to match the filter. The filter can be a selector, one or more specific DOM elements, a jQuery object, or a function that tests each element and returns true if it should be included.

Get jQuery and JavaScript Phrasebook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.