jQuery

jQuery Intro

jQuery Intro Quiz

jQuery Intro Exercise

jQuery Basic

jQuery Basic Quiz

jQuery Basic Exercise

jQuery Advance

jQuery Advance Quiz

jQuery Advance Exercise

jQuery Selectors

jQuery Effects

jQuery Events

jQuery Methods and Properties

jQuery Traversing

jQuery CSS and HTML Methods

jQuery parents() Method

jQuery parents() Method

 

 

The parents() method is used to return all ancestor elements of the selected element. It can be a parent, grandparent, great-grandparent, and so on. It traverses up to the root element.

 

Some of its properties are:-

 

  1. It begins with the parent element
  2. Travels up the DOM tree and returns all ancestors that match the passed expression
  3. The returned object contains zero or more than one element

 

Syntax:-

 

Its syntax is:- $(selector).parents(filter)

 

Further Explanation:-

 

Parameter Description
filter Optional. Specifies a selector expression to narrow down the search for ancestors

Code Explanation

All Tutorials related to jQuery Traversing

All Sections related to jQuery