jQuery :not() Selector Last Updated : 06 Jul, 2023 Comments Improve Suggest changes Like Article Like Report The jQuery :not() selector is used to select all the elements which are not selected. Syntax: $(":not(selector)")Parameter: selector: Used to specify that the element is not to be selected. The selector parameter accepts any kind of selector.Example 1: Change the background color of the p element. HTML <!DOCTYPE html> <html> <head> <title>jQuery :not() Selector</title> <script src= "https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"> </script> <script> $(document).click(function () { $("p:not(.intro)").css( "background-color", "green"); }); </script> </head> <body> <center> <h1>Geeks for Geeks</h1> <p class="intro"> A Computer Science Portal for Geeks </p> <p>jQuary :not selector</p> <p>I change my background color</p> <p>language option</p> <ul id="choose" style="width:5em; margin:0 auto;"> <li>JAVA</li> <li>C++</li> <li>PYTHON</li> </ul> <button>Change color</button> </center> </body> </html> Output: Example 2: HTML <!DOCTYPE HTML> <html> <head> <title>jQuery :not() Selector</title> <script src= "https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js"> </script> </head> <body style="text-align:center;"> <h1>GeeksForGeeks</h1> <h2>jQuery | :not() Selector</h2> <p class="GFG-1" style="font-size: 15px; font-weight: bold;"> GFG-1 </p> <p class="GFG-2" style="font-size: 15px; font-weight: bold;"> GFG-2 </p> <p class="GFG-3" style="font-size: 15px; font-weight: bold;"> GFG-3 </p> <button id="button"> Change content </button> <p class="GFG" style="color:green; font-size: 20px; font-weight: bold;"> </p> <script> $("button").on('click', function () { $('p[class^="GFG-"]:not(.GFG-1)').text("new Content"); }); </script> </body> </html> Output: Comment More infoAdvertise with us Next Article jQuery :not() Selector V Vijay Sirra Follow Improve Article Tags : Web Technologies JQuery jQuery-Selectors Similar Reads jQuery * Selector The jQuery * selector selects all the elements in the document, including HTML, body, and head. If the * selector is used together with another element then it selects all child elements within the element used. Syntax: $("*")Parameters: *: This parameter is used to select all elements.Example 1: Se 1 min read jQuery #id Selector jQuery is an open-source JavaScript library that simplifies the interactions between an HTML/CSS document, or more precisely the Document Object Model (DOM), and JavaScript. Elaborating on the terms, it simplifies HTML document traversing and manipulation, browser event handling, DOM animations, Aja 1 min read jQuery .class Selector The jQuery .class selector specifies the class for an element to be selected. It should not begin with a number. It gives styling to several HTML elements. Syntax: $(".class") Parameter: class: This parameter is required to specify the class of the elements to be selected.Example 1: In this example, 1 min read jQuery multiple classes Selector The jQuery multiple class selector is used to select multiple classes of an HTML document. Syntax: $(".class1, .class2, .class3, ...")Parameter: class: This parameter is required to specify the class of the elements to be selected.Example 1: In this example, we will select the multiple classes by us 1 min read jQuery element Selector jQuery is an open-source JavaScript library that simplifies the interactions between an HTML/CSS document, or more precisely the Document Object Model (DOM), and JavaScript. Elaborating the terms, it simplifies HTML document traversing and manipulation, browser event handling, DOM animations, Ajax i 1 min read jQuery multiple elements Selector The jQuery multiple elements Selector is used to select multiple elements of an HTML document. Syntax: $("element1, element2, element3, ...")Parameter: element: This parameter is required to specify the elements to be selected.Example 1: In this example, we will select the multiple elements by using 1 min read jQuery :first Selector The jQuery :first Selector is used to select the first element of the specified type. Syntax: $(":first")Example 1: In this example, we will select the first <p> element by using jQuery :first Selector. HTML <!DOCTYPE html> <html> <head> <script src= "https://ajax.goo 1 min read jQuery :last Selector The jQuery :last Selector is used to select the last element of the specified type. Syntax: $(":last")Example 1: In this example, we will select the last <p> element by using jQuery :last Selector. HTML <!DOCTYPE html> <html> <head> <script src= "https://ajax.googleap 1 min read jQuery :even Selector jQuery is an open-source JavaScript library that simplifies the interactions between an HTML/CSS document, or more precisely the Document Object Model (DOM), and JavaScript. Elaborating on the terms, it simplifies HTML document traversing and manipulation, browser event handling, DOM animations, Aja 2 min read jQuery :odd Selector jQuery is an open-source JavaScript library that simplifies the interactions between an HTML/CSS document, or more precisely the Document Object Model (DOM), and JavaScript. Elaborating the terms, it simplifies HTML document traversing and manipulation, browser event handling, DOM animations, Ajax i 2 min read Like