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
Post a Comment