2015-10-16 69 views
0

有一个奇怪的问题。 Ubuntu Chrome与FireFox。在Firefox上,它可以正常工作,在Chrome上它让我处于无尽的警报循环中。为什么?Ubuntu和Chrome上的jQuery focus()区别

jQuery(document).ready(function(){ 

    jQuery('#craigslist-send-email-text-box-123').focusIn(function(){ 
     alert('why does this alert repeat in Chrome but not in FF?'); 
     jQuery('#email-message-123').slideDown(); 
    }); 
}); 

在Chrome中,似乎不断循环焦点,迫使我点击“防止对话”或我无法逃脱警报循环。在我的平板电脑Chrome上,它似乎有效。 Ubuntu的问题?

+0

你能重现该问题? – undefined

+0

这是一个错误。当你专注时,它会调用警报(失去焦点),然后当它完成时,返回焦点,调用循环。 Chrome不正确地处理它。 – Casey

回答

1

试试这个覆盖镀铬:

jQuery(document).ready(function($e){ 

    jQuery('#craigslist-send-email-text-box-123').focusIn(function(){ 
     alert('why does this alert repeat in Chrome but not in FF?'); 
     jQuery('#email-message-123').slideDown(); 
     $e.preventDefault(); //weird but see if that gets around the bug. 
    }); 
}); 
相关问题