根据可见性 属性 匹配元素
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>jquery</title>
<script type="text/javascript" src="./js/jquery-1.7.1.min.js"></script>
<script type="text/javascript">
$(function(){
//选择器 内容
$('ul li:contains(1)').css('color','red');//选中内容中含有1的元素
$('ul li:empty').css('color','red');//选中空元素
$('div:has(p)').css('color','red');//选中有指定子元素的元素
$('ul li:parent').css('color','green');//匹配含有元素或文本的元素,与empty相反
//可见性
$('ul li:hidden');//匹配所有不可见元素
$('ul li:visible');//匹配所有可见元素
$('ul li[id]').css('color','yellow');//含有id属性的元素
$('ul li[id="one"]');//匹配id是one的元素
$('ul li[id!="one"]');//匹配id不是one的li元素
$('ul li[id^="on"]');//匹配id以on开头的li元素one符合要求
$('li[id$="ne"]');//匹配id以ne结尾的li元素
$('li[id*="n"]');//匹配id包含n的li元素
//以上功能可以重复写多个 })
</script>
</head>
<body>
<ul>
<li>1</li>
<li id="one">2</li>
<li>3</li>
<li>4</li>
<li></li>
</ul>
<div>
<p>我是div里的p标签</p>
</div>
<div>
我是div标签
</div> </body>
</html>
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKwAAADbCAIAAAB/dO32AAAG4UlEQVR4nO2dPXIbORBGJ2EoXUE6gkpnkE/FxOVgN/SGu6kPITPxKZjIZV/AVY6YOfo2oMUazgCNxpBoQuZ7xVLND4DpaTwCIxkmB8HVM1w6ALg8SABIAEgAQgIQEoCQAIQEICQAIQEICUBIAEICEBKAkACEBCAkACEBCAlA3UowvO80sD+SHnM9vB+QIJLucr3vfiSIpHmud792m++bzffN7teuHM1r3yNBJG1z/fLz5e7j3X54v//n/uvPr96wkCCQtrl++vS0N2D/evfpnTcsJAikba5v/roZS3D79603LCQIpG2uH/59GEvw+N+jNywkCKRtrp+/Pa8+rPYGrD6sPn/77A0LCQJpnuvtj+36y3r9Zb39sfXXQoJIOs01EkTSaa6RIBJyDUgASABCAhASgJAAhASgLiUYRi+IoLdED5ltaEhXiZ4H01V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