Get your own website Result Size: 625 x 565
x
 
<!DOCTYPE html>
<html>
<body>
<h1>Set outerText</h1>
<p>When setting the outerText, the entire element gets replaced.</p>
<p>Click the button to change (and remove) the h1 element:</p>
<button onclick="myFunction()">Change Header</button>
<script>
function myFunction() {
  var x = document.getElementsByTagName("h1")[0];
  x.outerHTML = "Changed content!";
}
</script>
</body>
<!-- Mirrored from www.w3schools.com/jsref/tryit.asp?filename=tryjsref_node_outertext by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 21 Dec 2022 17:39:44 GMT -->
</html>