<html>
<body>
<h1>The Element Object</h1>
<h2>The insertAdjacentText() Method</h2>
<button onclick="myFunction()">Insert</button>
<p>Click "insert" to insert some text before the header:</p>
<h2 id="myH2">My Header</h2>
<script>
function myFunction() {
const h2 = document.getElementById("myH2");
let text = "My inserted text";
h2.insertAdjacentText("beforebegin", text);
}
</script>
</body>
</html>