Edit This Code:
<!DOCTYPE html>
<html>
<body>

<p>Click the button to create an ASIDE element containing a H4 and P element.</p>

<button onclick="myFunction()">Try it</button>

<script>
function myFunction() {
    var x = document.createElement("ASIDE");
    x.setAttribute("id", "myAside");
    document.body.appendChild(x);

    var heading = document.createElement("H4");
    var txt1 = document.createTextNode("Epcot Center");
    heading.appendChild(txt1);
    document.getElementById("myAside").appendChild(heading);

    var para = document.createElement("P");
    var txt2 = document.createTextNode("The Epcot Center is a theme park in Disney World.");
    para.appendChild(txt2);
    document.getElementById("myAside").appendChild(para);
}
</script>

</body>
</html>


Result:
Try it Yourself - © w3schools.com
Privacy Policy