html部分
<form method="post" id="test">
<input type="text" name="test1">
<a href="###" id="a">sumbit</a>
</form>
jQuery部分
$('#a').on('click',function () {
$('#test').submit();
})
本文介绍了一种使用jQuery简化HTML表单提交的方法。通过为表单中的按钮元素添加点击事件监听器,当按钮被点击时,可以立即触发表单的提交行为,从而避免了传统的表单提交方式中可能出现的页面刷新等问题。
html部分
<form method="post" id="test">
<input type="text" name="test1">
<a href="###" id="a">sumbit</a>
</form>
jQuery部分
$('#a').on('click',function () {
$('#test').submit();
})
1759

被折叠的 条评论
为什么被折叠?