<html>
<body>
<h1>The Element Object</h1>
<h2>The insertAdjacentHTML() Method</h2>
<button onclick="myFunction()">Insert</button>
<p>Click "Insert" to insert a span inside the header:</p>
<h2 id="myH2">My Header</h2>
<script>
function myFunction() {
const h2 = document.getElementById("myH2");
let html = "<span style='color:red'>My span</span>";
h2.insertAdjacentHTML("afterbegin", html);
}
</script>
</body>
</html>