Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript add button to div

// get the element you want to add the button to
var myDiv = document.getElementById("demo");

// create the button object and add the text to it
var button = document.createElement("BUTTON");
button.innerHTML = "Button";

// add the button to the div
myDiv.appendChild(button);
 
PREVIOUS NEXT
Tagged: #javascript #add #button #div
ADD COMMENT
Topic
Name
9+4 =