jquery parent() method


Translation results:

parent

UK [ˈpeərənt] US [ˈperənt]

n.Father (or mother); ancestor; root, origin; protector

jquery parent() methodsyntax

Function:parent() Gets the parent element of each element in the current matching element set. Filtering with a selector is optional.

Syntax:.parent(selector)

Parameters:

Parameter Description
selector String value, containing the selector expression used to match elements.

Description:If given a jQuery object that represents a collection of DOM elements, the .parent() method allows us to search for these elements in the DOM tree. parent element and constructs a new jQuery object with the matching element. The .parents() method is similar to the .parent() method, except that the latter traverses a single level up the DOM tree. This method accepts an optional selector expression of the same type as the argument we passed into the $() function. If this selector is applied, elements will be filtered by testing whether they match the selector.

jquery parent() methodexample

    

Hello

Hello Again

Run instance »

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

Popular Recommendations

Home

Videos

Q&A