Categories
JavaScript Answers

How to get the parent div of element with JavaScript?

Spread the love

To get the parent div of element with JavaScript, we use the parentNode property.

For instance, we write

const parentDiv = pDoc.parentNode;

to get the parent div element of the pDoc element with the parentNode property.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

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