表单提交问题和解决方法? [英] Form Submit Problem and workaround?

查看:80
本文介绍了表单提交问题和解决方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好...我在jquery中提交表单时遇到问题.你看我有这个表格

Hi guys... im having problem with form submit in jquery. You see i have this form

<form id="myform" action="toMypage.php" method="POST">
  <input type="submit" value="reset" id="reset" />
  <input type="text" id="txt" />
</form>



如您所见,在我的表单中,我有一个按钮,即重置",使用此结构,这是我的jquery代码



as you can see in my form i have a button namely "reset" and using this structure this is my jquery code

$("#form_search").submit(function(){

     alert("not reset");
     doFilterCall("search");
     return false;
		
	
});
$("#reset").click(function(){
     alert("reset");
     doFilterCall("reset");
     return false;	
});



但是这里的问题是,当我将注意力集中在文本字段上并键入一些内容并按回车键之后,似乎重置按钮是触发器而不是$(form).submit();

我们该如何解决?在此先感谢



but the problem here is that when i set my focus on my textfield and type something and hit the enter key after that it seems that the reset button is trigger instead of the $(form).submit();

how do we do a workaround on this? thanks in advance

推荐答案

(" ).submit(function(){ alert(" ); doFilterCall(" ); 返回 ; });
("#form_search").submit(function(){ alert("not reset"); doFilterCall("search"); return false; });


(" ).click (功能(){ alert(" ); doFilterCall(" ); 返回 ; });
("#reset").click(function(){ alert("reset"); doFilterCall("reset"); return false; });



但是这里的问题是,当我将注意力集中在文本字段上并键入一些内容并在按下回车键后,似乎是触发了重置按钮,而不是



but the problem here is that when i set my focus on my textfield and type something and hit the enter key after that it seems that the reset button is trigger instead of the


(窗体). Submit();

我们该如何解决?预先感谢
(form).submit();

how do we do a workaround on this? thanks in advance


这篇关于表单提交问题和解决方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆