首页 > 程序开发 > web前端 > JavaScript >

Amazing blank in jQuery

2011-07-30

<html> <head> <script type="text/javascript" src="jquery-1.6.2.js"></script> <script type="text/javascript"> $(function() { alert($(&#39;.test :hidden&#39;).length); //read in sequenc...

<html>

<head>

<script type="text/javascript" src="jquery-1.6.2.js"></script>

<script type="text/javascript">

$(function()

{

alert($(&#39;.test :hidden&#39;).length); //read in sequence, first .test then :hidden

alert($(&#39;.test:hidden&#39;).length); //read simultaneously, .test && :hidden

});

</script>

</head>

<body>

<div class="test">

<div style="display:none">aaa</div>

<div style="display:none">bbb</div>

<div style="display:none">vvv</div>

<div class="test" style="display:none">ddd</div>

</div>

<div style="display:none">eee</div>

<div style="display:none">fff</div>

</body>

</html>

alert($(&#39;.test:hidden&#39;).length);

It is possible to read this from the end. the hidden and class name test element

本文出自 “笨鸟先飞” 博客

相关文章
最新文章
热点推荐