假设我使用blur()事件对电子邮件id进行了验证,我正在执行以下操作:
$('#email').blur(function(){
//make ajax call , check if duplicate email exist and if duplicate is there do :
$('#email-error').html('duplicate email exisit');
});但是,当我使用blur()时,如果我在输入框上,单击其他地方(模糊事件发生),如果我切换到另一个选项卡,并再次返回到(浏览器的)选项卡,我的页面冻结,有人能给我一个替代吗?
发布于 2012-09-15 14:39:28
与模糊使用不同,当元素的值为changes.Your 模糊事件或focusout event时, function.The change事件将发送到元素,无论数据是否已更改,每次文本框失去焦点时,都将不必要地触发ajax请求。
$('#email').change(function(){
//make ajax call , check if duplicate email exist and if duplicate is there do :
$('#email-error').html('duplicate email exisit');
});发布于 2012-09-15 14:43:43
不是模糊,而是像这样添加
$('#email').focusout(function(){
$('#email-error').html('duplicate email exisit');
});https://stackoverflow.com/questions/12435103
复制相似问题