Chrome上的jQuery blur()无效 [英] jQuery blur() on Chrome not working

查看:1517
本文介绍了Chrome上的jQuery blur()无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在MacOSX上运行 http://jsfiddle.net/q84wv/ Chrome 最新版本。

I'm on MacOSX running this http://jsfiddle.net/q84wv/ on Chrome latest version.

它无法正常运行,而在Firefox上运行它可以完美运行,任何线索?

It won't work, while running that on Firefox it works perfectly, any clue?

推荐答案

假设您希望在用户时触发 alert()从锚点中标出,或完成点击事件,这应该有效:

Assuming that you want the alert() to be triggered either when the user tabs out from the anchor, or completes a click event, this should work:

$('.menu a').on('blur mouseup',function(){
    alert('oh');
});

检查这个 jsFiddle

这真的取决于你要归类为 blur 这里。如果您希望每当用户的鼠标离开元素时触发它,您可以使用 mouseleave 代替:

It really depends what you're classing as blur here. If you're wanting it to trigger whenever the user's mouse leaves the element, you can use mouseleave instead:

$('.menu a').on('blur mouseleave',function(){
    alert('oh');
});

这篇关于Chrome上的jQuery blur()无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆