jQuery 学习 空格问题
var $alltext= $("#form1 :text"); //带空格的选择器,表示后代选择器
var $alltext= $("#form1:text"); //不带空格的选择器,表示筛选
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title> New Document </title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
<script src="../scripts/jquery-1.7.2.js" type="text/javascript"></script>
<script>
$(function(){
var $t_a=$('.test :hidden');//表示后代选择器
var $t_b=$('.test:hidden');//筛选
var len_a=$t_a.length;
var len_b=$t_b.length;
alert("$('.test :hidden')="+len_a);//4
alert("$('.test:hidden')="+len_b);//3
})
</script>
</head>
<body>
<div class="test">
<div style="display:none">aa</div>
<div style="display:none">bb</div>
<div style="display:none">cc</div>
<div class="test" style="display:none;">dd</div>
</div>
<div class="test" style="display:none;">ee</div>
<div class="test" style="display:none;">ff</div>
</body>
</html>