Jquery IE 9.0.11中按钮点击未触发时表单提交事件
仅在IE9.0.11中,当我在文本框中按enter键时,submit事件就启动了。如果单击搜索按钮,则“提交”事件不会触发。此时页面正在提交给自己。清除单击事件在此处正常触发 我有IE 9.0.12,它表现正常 HTML表单Jquery IE 9.0.11中按钮点击未触发时表单提交事件,jquery,html,forms,Jquery,Html,Forms,仅在IE9.0.11中,当我在文本框中按enter键时,submit事件就启动了。如果单击搜索按钮,则“提交”事件不会触发。此时页面正在提交给自己。清除单击事件在此处正常触发 我有IE 9.0.12,它表现正常 HTML表单 <form name="frmCollegeReview" method="Post" action=""> <table border="0" cellspacing="0" style="border-collapse: collapse" w
<form name="frmCollegeReview" method="Post" action="">
<table border="0" cellspacing="0" style="border-collapse: collapse" width="100%"
id="table3">
<tr>
<td width="15%" class="lineitem0">College Key</td>
<td width="85%" class="lineitem0">
<input maxlength="6" name="txtCollegeKey" size="15" class="field" value="">
</td>
</tr>
<tr>
<td width="15%"> </td>
<td width="85%">
<input type="image" src="/pics/btn/btn_search.gif" alt="Search" id="formSubmit">
<a href="#" id="formReset">
<img border="0" src="/pics/btn/btn_clear.gif">
</a>
</td>
</tr>
</table>
</form>
试试这个:
$("input[type='image']").live('click', function(){
$("form[name='"+CollegeReview._enum.SeachForm+"']").submit(function(){
CollegeReview.PopulateForReview();
});
return false;
});
嗯,您是否在提交处理程序中返回false?请使用
.on()
而不是.live()
,除非您使用的是较旧版本的jQueryyou,您是通过输入[type=“image”]
提交表单的。它不应该是input[type=“submit”]
No,它不应该是,因为image
attr是用于自定义提交按钮的。在这种情况下,返回false应该没有问题。在这种情况下,on()或.live()应该不是问题。我必须使用live,因为这个网站使用的是jquery 1.4.2@kidwon是正确的,图像属性用于自定义提交按钮。它会处理文本框中的“返回命中”吗?如果您触发输入[type='image']
的
,则绝对正确。以下操作仅适用于按钮单击。它在“回击”上不起作用,同样,它只在IE 9.0.11上起作用$(“#”+CollegeReview._enum.SearchFormButton).live('click',function(){CollegeReview.PopulateForReview();return false;});因此,在IE9.0.11中,在两个不同的触发器之间,要么是一个,要么是另一个,我将把它标记为选中的答案。它至少激活了IE 9.0.11的点击按钮。
$("input[type='image']").live('click', function(){
$("form[name='"+CollegeReview._enum.SeachForm+"']").submit(function(){
CollegeReview.PopulateForReview();
});
return false;
});