样例:
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="Generator" content="EditPlus®">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
<title>Document</title>
</head>
<script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>
<body>
<div>
<span style="display:none;" id="span1">1</span>
<span id="span2">2</span>
</div>
</body>
</html>
- 匹配可见元素
$("div").find("span:visible").attr("id")
匹配结果为:span2
- 匹配不可见元素
$("div").find("span:hidden").attr("id")
匹配结果为:span1