How to access child element(s) of parent element using jQuery?

jquery logo

jQuery provides with quite a handful of useful functions to traverse through child elements in different ways.
I’ll summarize few important of them

children()

This method will return all the direct children of Parent element.

parent()

This method returns parent element of current child element

 

 parents()

This method is similar to parent() except it return all the parent elements that is to say parent,grand parent, great grand parent element till body element.

find()

This method will search for element in descendants of Parent element.

first()

This first() method returns the first element of the selected elements.

last()

This method works opposite to first(). It will return last element of the selected elements

siblings()

This method will returns through all the elements having same parent.

next()

This method is used to traverse thorough sibling elements

Tags: