As title says, is there a way to send form
when element outside of form is clicked? Plus, is it available without using form
associated (button
/input
etc.) elements?
As example, can form
be submitted when div
is clicked?
As title says, is there a way to send form
when element outside of form is clicked? Plus, is it available without using form
associated (button
/input
etc.) elements?
As example, can form
be submitted when div
is clicked?
4 Answers
Reset to default 4Sure:
<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>
document.getElementById("formName").submit();
To submit the form, you can call form.submit()
.
Sure, assign an id to that form.
Once you click the desired element (button/input/div) you can do somthing like this in javascript
$("#YourFormId").submit();
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745400315a4626069.html
评论列表(0条)