parents

UK['peərənts] US['peərənts]

n.Parents (plural noun of parent)

until

English[ənˈtɪl] US[ʌnˈtɪl]

prep.Until...;before...

conj.Until..., before...;until …talent

jquery parentsUntil() method syntax

Function:parentsUntil() Gets the ancestor elements of each element in the current matching element set, until (but not including) the element matched by the selector, DOM node or jQuery object.

Syntax 1: .parentsUntil(selector,filter)

Parameters:

Parameter Description
selector Optional. A string value that specifies the selector expression where to stop matching ancestor elements.
filter Optional. String value containing the selector expression used to match the element.

Syntax 2:.parentsUntil(element,filter)

Parameters:

Parameters Description
element Optional. A DOM node or jQuery object indicating where to stop matching ancestor elements.
filter Optional. String value containing the selector expression used to match the element.

Description:If given a jQuery object that represents a collection of DOM elements, the .parentsUntil() method allows us to search for these elements in the DOM tree. Ancestor elements until an element matched by the selector (the argument passed to the method) is encountered. The returned jQuery object contains all ancestor elements except the one matched by the selector specified by the .parentsUntil() method. If there is no match or no selector is applied, all ancestor elements will be selected; in this case, the method selects the same elements as .parents() if no selector is provided. As of jQuery 1.6, a DOM node or jQuery object, instead of a selector, can be used as the first argument to the .parentsUntil() method. This method accepts an optional selector expression as its second parameter. If this parameter is applied, elements will be filtered by testing whether they match this selector.

jquery parentsUntil() method example

    
  • I
  • II
    • A
    • B
      • 1
      • 2
      • 3
    • C
  • III
Run instance »

Click the "Run instance" button to view the online instance