<html>
<body>
<h1>The Element Object</h1>
<h2>The before() Method</h2>
<div id="myDiv">Hello</div>
<p>Click to insert an element before the div:</p>
<button onclick="myFunction()">Click here</button>
<script>
function myFunction() {
const div = document.getElementById("myDiv");
const h3 = document.createElement("h3");
div.before(h3);
h3.append("Hello! I am an h3");
}
</script>
</body>
</html>