jQuery not() Method

Last Updated:

jQuery not() Method

The jQuery not() method returns elements that do not match with specified element/selector/function.

Example

HTML Editor
<!DOCTYPE html> <html lang="en-US"> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> </head> <body> <h1>jQuery not() Method</h1> <p id="point">This is paragraph1.</p> <p>This is paragraph2.</p> <script> $(document).ready(function(){ $("p").not("#point").css("color", "red"); }); </script> </body> </html>

Syntax

$(selector).not(elem);

Parameter Values

Value Type Explanation
elem Required Specifies a string containing a selector expression, a DOM element, or an array of elements to match against the set.

Browser Support

Devicedesktopmobile
Browsergoogle chromesafarifirefoxinternet Exploreredgeoperagoogle chromesafarifirefoxedgeoperaandroid webviewsamsung internet
not()YesYesYesYesYesYesYesYesYesYesYesYesYes

Share this Page

Meet the Author