jQuery parent method

If you want to apply the CSS to the parent element of the selected, you can use the jQuery parent method to do this. The method requires only the selector to select the element to which you want to apply the CSS to the parent.

You can use id’s or class name to select the HTML element. You can use the other methods like the jQuery addClass method to add the class and other methods with the jQuery parent method as given below.

How to Find the Parent of HTML Element Using jQuery parent() Method

You have to follow the syntax given below.

See the example given below to learn the working of the jQuery parent method.


Test it Live


  • Welcome to Tutorialdeep Web Tutorial!
  • Learn jQuery With Working Examples.

The above example add the class to the parent of the selected HTML element. After you click the button given above, the parent() add the class to the parent Element and so apply the CSS comes with the class.


Get FREE Access to Toolkit and Resources that we are using in Tutorialdeep that Every Professional Should Have! in one handy PDF.

Get the PDF

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Download Link Will be Send to Your Email id