The [attribute!=value] selector in jquery is used to select each element that doesn’t have the specified attribute and value.
Syntax:
$("[attribute!='value']")
Parameter:
- attribute: This parameter is required to specify the attribute to be searched.
- value: This parameter is required to specify the value to be searched.
Example-1:
<!DOCTYPE html> <html> <head> <script src= </script> <script> $(document).ready(function() { $("p[class!='intro']").css( "background-color", "green"); }); </script> </head> <body> <center> <h1>Welcome to GeeksForGeeks </h1> <p class="intro">Geeks</p> <p>For</p> <p>GEEKS</p> <p></p> Who is your favourite: <ul id="choose"> <li>Geeks1</li> <li>Geeks2</li> <li>Geeks3</li> </ul> </center> </body> </html> |
chevron_right
filter_none
Output:

Example-2:
<!DOCTYPE html> <html> <head> <script src= </script> <script> $(document).ready(function() { $("p[class='intro']").css( "background-color", "green"); }); </script> </head> <body> <center> <h1>Welcome to GeeksForGeeks </h1> <p class="intro">Geeks</p> <p>For</p> <p>GEEKS</p> <p></p> Who is your favourite: <ul id="choose"> <li>Geeks1</li> <li>Geeks2</li> <li>Geeks3</li> </ul> </center> </body> </html> |
chevron_right
filter_none
Output:

Recommended Posts:
- jQuery | :input Selector
- jQuery | :nth-of-type() Selector
- jQuery | :enabled Selector
- jQuery | element Selector
- jQuery | :last Selector
- jQuery | :button Selector
- jQuery | animated Selector with Example
- jQuery | :header Selector
- jQuery | #id Selector
- jQuery | .class Selector
- jQuery | :text Selector
- jQuery | :password Selector
- jQuery | :file Selector
- jQuery | :submit Selector
- jQuery | :checked Selector
- jQuery | :reset Selector
- jQuery | :selected Selector
- jQuery | :disabled Selector
- jQuery | :first-of-type Selector
- jQuery | :last-of-type Selector
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


