jquery焦点没有在firefox上设置 [英] jquery focus not setting on firefox

查看:96
本文介绍了jquery焦点没有在firefox上设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将焦点设置到我的文本区域。以下是我的代码:

I want to set focus into my text area. Following is my code:

$this.textInput.val('').show().focus();

但它不起作用。实际上,当我按下鼠标按钮时,它会出现,但是当我将鼠标按下时,它会从文本区域移除。因此经过大量搜索,我发现了setTimout方法,如:

But it is not working. Actually when I press mouse button it appeared but when I mouseup it remove from text area. So after lot of searching I found setTimout method like :

$this.textInput.mouseover(function(){                                
setTimeout($this.focus(),0);
});

但它仍然无法在Firefox中运行。我有最新的13.0版本,但它仍然包含问题,但谷歌铬它正常工作。 firefox有什么问题可以解决它。

But still its not working in firefox. I have the latest 13.0 version but still it containing the problem but google chrome it is working properly. What's the problem with firefox is there any solution for it.

提前致谢。

推荐答案

试试这个:

$('#textareaid').click(function(){
                $(this).after('focused?');
                el = $(this);
                setTimeout(function(){
                    el.trigger('focus')
                },1);
            })

使用.click方法。我会为你工作。

Use .click method. I'll work for you.

这篇关于jquery焦点没有在firefox上设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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