0
Q:

create element javascript with id

var btn = document.createElement('div'); 
btn.setAttribute("id", "div1");
3
var btn = document.createElement("BUTTON");   // Create a <button> element
btn.innerHTML = "CLICK ME";                   // Insert text
document.body.appendChild(btn);               // Append <button> to <body>
3
var element = document.createElement("div"); //Create div
document.body.appendChild(element); //Add to bottom of <body> tag
2

New to Communities?

Join the community