how to limit the jquery search scope

后端 未结 6 2317
别那么骄傲
别那么骄傲 2020-12-06 16:19

It looks like JQuery does the search in the current document when using a selector.

How to search for an element only inside a div

6条回答
  •  清歌不尽
    2020-12-06 16:48

    jQuery provides several ways to search for specific elements:

    $("#your_div").find(".your_things");        //Find everything inside
      //-or-
    $("#your_div").filter(".your_things");      //Find only the top level
      //-or-
    $("#your_div .your_things");                //Easiest
    

提交回复
热议问题