<html>
<body>
<h1>The Element Object</h1>
<h2>The outerHTML Property</h2>
<p id="myP">I am a paragraph! Click "Change" to replace me with a header.</p>
<button onclick="myFunction()">Change</button>
<script>
function myFunction() {
const element = document.getElementById("myP");
element.outerHTML = "<h2>This is a h2 element.</h2>";
}
</script>
</body>
<!-- Mirrored from www.w3schools.com/jsref/tryit.asp?filename=tryjsref_element_outerhtml_var by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 21 Dec 2022 17:39:44 GMT -->
</html>