document createelement add attribute code example
Example: javascript create element with attributes
var element = document.createElement("span");
element.setAttribute("style", "color: red");
document.body.appendChild(element);
var element = document.createElement("span");
element.setAttribute("style", "color: red");
document.body.appendChild(element);