javascript - Function to submit form by id -


how can submit form using form id function param? that:

html:

<a href="#" onclick="confirmsubmit(form1)">delete file</a> 

javascript:

function confirmsubmit(id) {     var agree=confirm("are sure wish delete file?");     if (agree)         document.getelementbyid('form' + id).submit();     else         return false; } 

you can pass form id string parameter(means in single quotes) onclick function.

see below

<a href="#" onclick="confirmsubmit('form1')">delete file</a> function confirmsubmit(id) {     var agree=confirm("are sure wish delete file?");     if (agree)       document.getelementbyid(id).submit();     else      return false; } 

Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -