jquery .find()

来源:互联网 发布:淘宝店需要购买软件吗 编辑:程序博客网 时间:2024/06/06 15:45

.find()

.find( selector )Returns: jQuery

Description: Get the descendants(子代) of each element in the current set of matched elements, filtered by a selector, jQuery object, or element.

.find( selector )

  • selector
    Type: Selector
    A string containing a selector expression to match elements against.
  • version added: 1.6.find( jQuery object )

    • jQuery object
      Type: Object
      A jQuery object to match elements against.
  • version added: 1.6.find( element )

    • element
      Type: Element
      An element to match elements against.

    Given a jQuery object that represents a set of DOM elements, the.find() method allows us to search through the descendants of these elements in the DOM tree and construct a new jQuery object from the matching elements. The.find() and .children() methods are similar, except that the latter only travels a single level down the DOM tree.

    The first signature for the .find()method accepts a selector expression of the same type that we can pass to the$() function. The elements will be filtered by testing whether they match this selector.

    Consider a page with a basic nested list on it:

     

     

  • 0 0
    原创粉丝点击