I want to pass multiple parameters to a function that is called via onClick. Here is the code:
div.innerHTML += '<input type="button" name="back" id="back" value="Back" onClick="homeForm(\'' + form,divName + '\')" />';
function homeForm(form,divName){
//do something
}
This works with one parameter but not two:
div.innerHTML += '<input type="button" name="back" id="back" value="Back" onClick="homeForm(\'' + form + '\')" />';
Could someone post a working method for this, or perhaps a cleaner way?
'onClick="homeForm(\'' + form,divName + '\')"'in the console and see what happens. Then work from there. If you want to learn how to properly bind event handlers, have a look at quirksmode.org/js/introevents.html