Easy Tutorial
❮ Misc Callbacks Has Misc Parsexml ❯

jQuery not() Method

jQuery Traversing Methods

Example

Return all <p> elements that do not have the class "intro":


Definition and Usage

The not() method returns elements that do not match a certain condition.

This method allows you to specify a condition. Elements that do not meet the condition are returned from the selection, while those that do meet the condition are removed.

This method is commonly used to remove one or more elements from a selected element set.

Tip: The not() method is the opposite of the filter() method.


Syntax

Parameter Description
criteria Optional. Specifies the selector expression, jQuery object, or one or more elements to be removed from the selected element set. <br> <br> Tip: To specify multiple conditions, use commas to separate them.
function(index) Optional. Specifies a function to run for each element in the set. If the function returns true, the element is removed; otherwise, the element is retained. index - The index position of the element in the set. Note: this refers to the current DOM element.

More Examples

Return all <p> elements that are not even-numbered

Multiple Conditions

Using jQuery Object

DOM

Using Function


jQuery Traversing Methods

❮ Misc Callbacks Has Misc Parsexml ❯