<!DOCTYPE html>
<html>
<body>
<p>Click the button to create a HEADER element containing a h3 element with some text.</p>
<button onclick="myFunction()">Try it</button>
<script>
function myFunction() {
var x = document.createElement("HEADER");
x.setAttribute("id", "myHeader");
document.body.appendChild(x);
var y = document.createElement("H3");
var t = document.createTextNode("This is a h3 element in a header element");
y.appendChild(t);
document.getElementById("myHeader").appendChild(y);
}
</script>
</body>
</html>