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>      

        <p class="test">

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

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

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

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

        </p>

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

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

    </body>

</html>

 

alert($('.test:hidden').length);

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

本文出自 “笨鳥先飛” 博客

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *