<strong>原理解釋:</strong> <br><br>var $t_a=$(".test :hidden") //帶空格表示的是選擇class為test裡面隱藏的元素; <br>var $t_a =$(".test:hidden")//不含空格表示的是選擇隱藏的class為test的元素; <br><br><strong>舉例說明:</strong> <br><div class="codetitle"> <span><a style="CURSOR: pointer" data="91662" class="copybut" id="copybut91662" onclick="doCopy('code91662')"><u>複製程式碼</u></a></span> 程式碼如下:</div> <div class="codebody" id="code91662"> <br> <br> <br><script type="text/javascript " src="jquery-1.3.2.min.js"></script> <br><script type="text/javascript"> <BR>$(document).ready(function(){ <BR>var $a1=$(".test :hidden"); <BR>var $a2=$(".test:hidden"); <BR>alert($a1.length " " $a2.length) <BR>} ) <BR></script> <br><style> <BR></style> <br> <br> <br><div class="test" style="display:none ;"> <br><p style="display:none">dddddddd</p> <br><p style="display:none">dddddddd</p> <br> </div> <br> <br> </div> <div class="test" style="display:none"></div> <br> <br> <br> <br>輸出結果分別為:2和3;