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() {
  const x = document.getElementsByTagName("h1")[0];
  x.outerText = "Changed content!";
}
</script>
</body>
</html>