jQuery filter() , end()

1. jquery filter(condition) :  过滤指定对象中符合条件的元素;

2.  jquery  end() : 回到原来的操作对象

3.  example :

     <body>
        <div id="someParentDiv"></div>
        <script type="text/javascript" src="jquery.js"></script>
        <script>
            $(function(){
                   $("<div class='foo'>First Hi</div><div>second Hi</div>").filter(".foo").click(function(){
                        alert("what's wrong");
                  }).end().appendTo($("#someParentDiv"));
            });//filter() 选择对象中类为foo的元素   //end()回到操作包含两个div的原对象
        </script>
    </body>

原文地址:https://www.cnblogs.com/rocky-fang/p/5200615.html