第14行,为什么得不到想要的结果呢? 1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <meta http-equiv="X-UA-Compatible" content="IE=edge"> 6 <title></title> 7 <script src="框架/jquery-2.2.0.min.js"></script> 8 <script type="text/javascript"> 9 $(function() { 10 var $t_a = $(‘.test :hidden‘); 11 var $t_b = $(‘.test:hidden‘); 12 var len_a = $t_a.length; 13 var len_b = $t_b.length; 14 alert("$(‘.test :hidden‘) =" + len_a);//4,不能得到这个结果!为什么是0 15 alert("$(‘.test:hidden‘) =" + len_b);//3 16 }) 17 </script> 18 </head> 19 <body> 20 <div> 21 <div style="display: none">aa</div> 22 <div style="display: none">bb</div> 23 <div style="display: none">cc</div> 24 <div class="test" style="display: none">dd</div> 25 </div> 26 <div class="test" style="display: none">ee</div> 27 <div class="test" style="display: none">ff</div> 28 </body> 29 </html>
时间: 2024-10-07 08:13:45