我对jQuery提交功能有一些疑问.
这是工作环境
jQuery:1.7.2,chrome(18.0.1025.168 m).
有两个问题.
第一名:
我的代码是这样的
HTML
<form id="test" action="..." method="post">
<input type="text" />
<input type="submit">
</form>
Run Code Online (Sandbox Code Playgroud)
jQuery的
$('#test').submit(function(){
return false;
})
Run Code Online (Sandbox Code Playgroud)
问题是它在firefox和opera中工作得很好但是chrome.
2ST:
html:如上所述.
jQuery的:
$('#test').submit(function(){
if(...)
alert(something..);
return false;
})
Run Code Online (Sandbox Code Playgroud)
它不适用于firefox,opera和chrome.它总是触发form.submit为什么.
我很困惑.谁能想出来谢谢!
Hac*_*ese 11
不要用return false;.试试这个:
$('#test').submit(function(event){
event.preventDefault();
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
16405 次 |
| 最近记录: |