Learn HTML DOM
Manipulating DOM Elements
4.5
Lesson

Updating HTML Using OuterHTML

We can get access to an HTML element along with all the nested code inside it using its outerHTML property.

In the console, we get a string representing the p element and all the nested elements inside it.