当前位置:编程学习 > JAVA >>

Amazing blank in jQuery

 

<html>

    <head>

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

        <script type="text/javascript">

            $(function()

            {

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

                alert($('.test:hidden').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($('.test:hidden').length);

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

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

补充:web前端 , JavaScript ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,