1// get the element you want to add the button to
2var myDiv = document.getElementById("demo");
3
4// create the button object and add the text to it
5var button = document.createElement("BUTTON");
6button.innerHTML = "Button";
7
8// add the button to the div
9myDiv.appendChild(button);