javascript - Is there a way to send form when element outside of form is clicked? -
as title says, there way send form
when element outside of form clicked? plus, available without using form
associated (button
/input
etc.) elements?
as example, can form
submitted when div
clicked?
sure:
<form name="myform" action="" method="post"> <!-- form inputs go here --> </form> <div id="formsubmit"></div> <script type="text/javascript"> var myform = document.forms['myform']; var formsubmit = document.getelementbyid('formsubmit'); formsubmit.onclick = function(){ myform.submit(); } </script>
Comments
Post a Comment