javascript create element and add to body code example
Example 1: create element javascript with class
// create div element by javascript with class
var div = document.createElement('div');
div.className = "div1";
Example 2: js create element
var newDiv = document.createElement("div");
document.body.appendChild(newDiv);