I am trying to create a div on click using javascript .All the code I found is using an already created div in the body .But I want the div to be created only on click and as many times the users wants.
document.body.onclick = function () {
var i;
i = document.createElement('div');
i.style.height = "10px";
i.style.width = "10px";
i.style.backgroundColor = "black";
document.body.appendChild(i);
}