i creating form javascript. have put onclick on tag call method when clicked. doing this, not appearing onclick.
function rempass() { var log = document.getelementbyid("login"); var form = document.createelement('form'); form.method = "post"; form.action = ""; log.appendchild(form); var input = document.createelement('input'); input.type = "text"; input.name = "username"; input.classname = "username"; input.placeholder = "usuario"; var = document.createelement('a'); a.classname = "bt-enter pink"; a.id = "recordar"; a.href = "#"; a.onclick = "remember()"; //here problem a.innerhtml = "recordar contraseƱa"; form.appendchild(input); form.appendchild(a); }
you need use method, not method's result nor string
a.onclick = remember;
and don't forget create
function remember(){ //some code }
Comments
Post a Comment