Dynamic Div

var divTag = document.createElement("div");

divTag.id = "div1";

divTag.setAttribute("align","center");

divTag.style.margin = "0px auto";

divTag.className ="dynamicDiv";

divTag.innerHTML = "This HTML Div tag created using Javascript DOM dynamically.";

document.body.appendChild(divTag);

0 Comments

You must be logged in to post a comment.