我在我们的网站#footer_leads 和#footer_leads2 上有两个表格,我有一个实时提交事件,但需要在表格被提交之前验证一些事情,所以我有这段代码
$('#footer_leads2, #footer_leads').live('submit', function(e){
e.preventDefault();
console.log('again');
var form = $(this); //save reference to form
if(somevalidation){
form.die();
form.submit(); //submit form
}
我假定 jQuery die事件会像上面的例子那样做,但页面只是进入无限循环并使我的浏览器崩溃......关于如何做到这一点的任何想法
最佳答案
来自 jQuery die()
页面:
Note: In order for .die() to function correctly, the selector used with it must match exactly the selector initially used with .live().
尝试使用 $('#footer_leads2, #footer_leads').die()
代替。
关于javascript - 如何删除 jQuery 中的实时提交事件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7840840/