Answers for "append button in javascript"

1

adding a button in javascript

// The code below should help
let btn = document.createElement("button");
btn.innerHTML = "Submit";
btn.type = "submit";
btn.name = "formBtn";
document.body.appendChild(btn);
Posted by: Guest on October-05-2021
-1

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);
Posted by: Guest on February-03-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language