jquery的:hidden选择器为什么会选中<select>标签
<html>
<head>
<title>forth.html</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<script type="text/javascript" src="../jquery.min.js"></script>
</head>
<body>
<form action="#" id="form1">
<select>
<option>Option</option>
</select>
<input type="hidden"/><div style="display:none">test</div>
</form>
</body>
<script type="text/javascript">
alert($("#form1 :hidden").length);
</script>
</html>
为什么结果是3,而不是2呢?谢谢。
怪叔叔和怪阿姨
9 years, 2 months ago
Answers
@Terry_139061 说的对,因为你选的是隐藏的标签,而option就是隐藏的标签。。select没有隐藏所以不会选中,
sss恶鬼黑兔
answered 9 years, 2 months ago