双驱动onblur事件 [英] double actuating onblur event
本文介绍了双驱动onblur事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的JavaScript code,这一次应该在重心的转移被执行。一切正常,但这code进行了两次一些奇怪的原因,所以我举两个警报窗口。
I have javascript code, which should be executed once at focus shift. Everything works, but this code is carried out two times for some strange reason, thus I give TWO alert windows.
$(document).ready(function() {
$('#username').blur(function() {
var formData = {
"username":$('#username').val()
};
$.ajax({
url:'check.php',
type:'POST',
data:'jsonData=' + $.toJSON(formData),
success: function(res) {
alert(res);
}
});
});
});
我是什么做错了吗?
What am I doing wrong?
推荐答案
我感动#username格,一切工作过,因为它应该在此之前code。
I moved this code before #username div and everything have worked as it should.
这篇关于双驱动onblur事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文