jQuery not | Using jquery not() selector method to filter document

jQuery not() method

The jquery not() method is opposite to filter() method. In filter method elements are filtered or reduced for the given matching criteria whereas not() method will filter those elements not matching.


.not( selector )

For example


Filter li in document with elements not having class name .midli.



Select or filter all div elements that are not using class leftmenu.

Working Example of not() method of jquery

In example below, when button is clicked, the not() method will traverse through document and find all <p>. It will change the color to black for all <p>s which class is not midtext.

Experience this example online

Was this article helpful?

Related Articles

Leave A Comment?