jQueryセレクタには特殊記号とスペースが含まれている注意事項





    
    
    <script src="../jquerysource/jquery.js" type="text/javascript"/>
    <script>
        //1      ".","#","(","]"     
        $(function(){
            $("#id\\#b").click(function(){
                alert("#id\\#b");
            });
            $("#id\\[1\\]").click(function(){
                alert("#id\\[1\\]");
            });
            //2jQuery    ,1.3.1       1.1.0      @  .1.3            @  
            //1.1//$("div[@title='test']")
            //  //$("div[title='test']")
            //3             
            var a = $('.test :hidden');//  class "test"          
            var b = $('.test:hidden');//  class test   
            alert(a.length+"   ");
            alert(b.length+"  ");
        });
    </script>


    <div id="id#b">id#b</div>
    <div id="id[1]">id[1]</div>
    <div class="test">
            <div style="display: none">aa</div>
            <div style="display: none">bb</div>
            <div style="display: none">cc</div>
            <div class="test" style="display: none">dd</div>
    </div>
    <div class="test" style="display: none">ee</div>
    <div class="test" style="display: none">ff</div>

</code></pre> 
  <br/> 
 </div> 
</div>
                            </div>
                        </div>