Home > Article > Web Front-end > Introduction to the basics of jQuery:not() selector
Definition and usage
:not() selector selects all elements except the specified element.
The most common usage: used with other selectors to select all elements in the specified combination except the specified element (such as the example above).
Syntax
$(":not(selector)")
Parameters Description
selector required. Specifies elements that are not selected.
This parameter accepts any type of selector.
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>菜鸟教程(runoob.com)</title> <script src="http://cdn.static.runoob.com/libs/jquery/1.10.2/jquery.min.js"> </script> <script> $(document).ready(function(){ $("p:not(.intro)").css("background-color","yellow"); }); </script> </head> <body> <h1>欢迎来到我的主页</h1> <p class="intro">PHP中文网</p> <p>学的不仅是技术,更是梦想!</p> <p>学的不仅是技术,更是梦想!</p> <p>你最喜欢的网站:</p> <ul id="choose"> <li>Google</li> <li>Taobao</li> <li>PHP中文网</li> </ul> </body> </html>
The above is the detailed content of Introduction to the basics of jQuery:not() selector. For more information, please follow other related articles on the PHP Chinese website!