How to add onclick to a html element dynamically using javascript -
i able create button element , add onclick event shown below.
elem.onclick=function() { alert("qweqweqwe"); }
how go using predefined function instead of defining function inside of event? like:
elem.onclick=func();
add eventlistener element has defined function call :
elem.addeventlistener("click", func, false); //where func function name
Comments
Post a Comment