Home > Web Front-end > JS Tutorial > body text

Introduction to the basics of jQuery:not() selector

巴扎黑
Release: 2017-06-22 17:56:28
Original
1674 people have browsed it

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>
Copy after login

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!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!