调用$()。焦点在Firefox的textarea不能按预期工作 [英] Calling $().focus on a textarea in Firefox doesn't work as expected

查看:139
本文介绍了调用$()。焦点在Firefox的textarea不能按预期工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在这里重现了这个问题: http://jsfiddle.net/Rc52x/5/点击这里!,textarea会获得焦点,您可以开始输入as预期的。

如果您在使用Firefox时点击它(现在我使用3.6.15),textarea不会获得焦点, >

这是什么?

您需要防止默认操作链接: http://jsfiddle.net/JAAulde/Rc52x/7/



Firefox正在关注它,导致textarea在获得后失去焦点。


I've reproduced the problem here: http://jsfiddle.net/Rc52x/5/

If you click on Click here! while using Chrome, the textarea gains focus and you can start typing as expected.

If you click on it while using Firefox (I'm using 3.6.15 right now), the textarea does NOT gain focus and typing does nothing.

What the heck?

解决方案

You need to prevent the default action of the link: http://jsfiddle.net/JAAulde/Rc52x/7/

Firefox is following it causing the textarea to lose focus after gaining.

这篇关于调用$()。焦点在Firefox的textarea不能按预期工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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