jQuery parent() Method
jQuery parent() Method
The parent() method is used to return the direct parent element of the selected element. It only traverses a single level up the DOM(Document Object Model) tree. For traversing up to the root, we have to use the parents() method.
Syntax:-
Its syntax is:- $(selector).parent(filter)
Further Explanation:-
Parameter | Description |
---|---|
filter | Optional. Specifies a selector expression to narrow down the parent search |