简体   繁体   English

jQuery 中的 focus() 和 focusout()

[英]focus() and focusout() in jQuery

I have a problem with focus() method in jQuery.我在 jQuery 中的 focus() 方法有问题。 Here is my code...这是我的代码...

  $('#input').focusout(function(){
    alert('message')
    $(this).focus();
  });

focusout() executed multiple times after calling focus() and because of the alert i can't do anything on the page! focusout() 在调用 focus() 后执行多次,由于警报,我无法在页面上做任何事情! Why?为什么?

I have edited my answer:我已经编辑了我的答案:

$('#input').focusout(function(){
 alert('message');
},function(){

});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM