Can someone explain me like i'm five why is it executing the function without the click event. And how to fix it. Thanks.
function test(){
alert("works");
}
function createButton(name,location,id,funX){
var button = document.createElement("input");
button.type = "submit";
button.name = name;
button.id = id;
button.onclick = funX;
var placeHolder = document.getElementById(location);
placeHolder.appendChild(button);
};
window.onload = function () {
createButton("Submit","content","submitEnd",test());
};