admin管理员组文章数量:1425734
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();
本文标签: javascriptIs there a way to send form when element outside of form is clickedStack Overflow
版权声明:本文标题:javascript - Is there a way to send form when element outside of form is clicked? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745400315a2657005.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论