如何使用< li>提交表单?而不是提交按钮? [英] How do I submit a form with a <li> instead of a submit button?
本文介绍了如何使用< li>提交表单?而不是提交按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我希望能够提交表单,但不必点击提交按钮,我希望能够点击< li>
元素并提交。
任何帮助都很棒!
预先感谢!
> Ncoder 解决方案您可以在LI上放置一个onclick事件,表单提交事件:
< form id =myFormaction =foo.htmmethod =post>
< ul>
< li onclick =myForm.submit();>点击我< / li>
< / ul>
< / form>
虽然您的表单可能不是标准的,但不是很容易访问。
I want to be able to submit a form but instead of having to click on a submit button, I'd like to be able to click on an <li>
element and have it submit.
Any help would be GREAT!
Thanks in advance!
Ncoder
解决方案 You could put an onclick event on the LI that calls the forms submit event:
<form id="myForm" action="foo.htm" method="post">
<ul>
<li onclick="myForm.submit();">Click me</li>
</ul>
</form>
Your form would be non-standard and not very accessible though.
这篇关于如何使用< li>提交表单?而不是提交按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文