Every time I try to add an onclick event to a newly created button, the event seems to get triggered before the button is even pressed. Here is how I've been trying to go about it:
var que = document.createElement("BUTTON");
var text = document.createTextNode("Question1");
que.appendChild(text);
document.body.appendChild(que);
que.setAttribute("onclick", function1());
Each time function1() is run before I even have a chance to press the button. Does anyone have any ideas of why?