not(expr)
从当前匹配元素集合中删除满足‘expr’的匹配元素集合。得到新匹配元素集合
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script>
$(document).ready(function(){
$("div").not(".green, #blueone")
.css("border-color", "red");
});
</script>
<style>
div { width:60px; height:60px; margin:10px; float:left;
background:yellow; border:2px solid white; }
.green { background:#8f8; }
.gray { background:#ccc; }
#blueone { background:#99f; }
</style>
</head>
<body>
<div></div>
<div id="blueone"></div>
<div></div>
<div class="green"></div>
<div class="green"></div>
<div class="gray"></div>
<div></div>
</body>
</html>
$("div").not(".green, #blueone")
删除div元素集合中,特殊样式为‘green’和元素id属性值为‘blueone’的元素。形成新元素集合。以下为新元素集合
<div></div>
<div></div>
<div class="gray"></div>
<div></div>