Categories
JavaScript Answers

How to get the body element of site using only JavaScript?

Spread the love

Sometimes, we want to get the body element of site using only JavaScript.

In this article, we’ll look at how to get the body element of site using only JavaScript.

How to get the body element of site using only JavaScript?

To get the body element of site using only JavaScript, we use the document.body property.

For instance, we write

document.body

to get the body element of the page.

Conclusion

To get the body element of site using only JavaScript, we use the document.body 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 *