jquery attribute!=value选择器 语法
作用:[attribute!=value] 选择器选取每个不带有指定属性及值的元素。带有指定的属性,但不带有指定的值的元素,也会被选择。
语法:$("[attribute!=value]")
参数:attribute 必需。规定要查找的属性。 value 必需。规定要查找的值。直线电机
jquery attribute!=value选择器 示例
<html> <head> <script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("body [id!=main_header]").css("background-color","#B2E0FF"); }); </script> </head> <body> <html> <body> <h1 id="main_header">Welcome to My Homepage</h1> <p class="intro">My name is Donald</p> <p>I live in Duckburg</p> <p>My best friend is Mickey</p> <h3 id="sub_header">My uncle is Scrooge</h3> <div id="choose"> Who is your favourite: <ul> <li>Goofy</li> <li>Mickey</li> <li>Pluto</li> </ul> </div> </body> </html> </body> </html>