How can I create a dynamic button with a click event with JavaScript?
I tried this, but when I click the add button, an alert message show up! It\'s not what I want
this:
element.setAttribute("onclick", alert("blabla"));
should be:
element.onclick = function () { alert("blabla"); }
Because you call alert instead push alert as string in attribute