jQuery | not() method with Examples
The not() is an inbuilt function in jQuery which is just opposite to the filter() method. This function will return all the element which is not matched with the selected element with the particular “id” or “class”.
The selector is the selected element which is not to be selected.
Parameters: It accepts a parameter “A” which is either “id” or “class” of the specified element.
Return Value: This will return all the elements except the selected elements.
In the below code all the paragraph element except with the class “main” get highlighted with the green color in the background.
In the below all the paragraph element with the id “main” get highlighted with the green color in the background.