Skip to content Skip to sidebar Skip to footer

Jquery Focus Not Setting On Firefox

I want to set focus into my text area. Following is my code: $this.textInput.val('').show().focus(); But it is not working. Actually when I press mouse button it appeared but when

Solution 1:

Use .trigger('focus'). I find it sometimes works better than .focus().

Solution 2:

Try this :

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

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

Solution 3:

$this does not mean anything. You should use $(this) or you can set a variable like this-

var $this=$(this)

Solution 4:

Not all elements are focusable but default, there is a tabindex attribute to fix that.

When you assign tabindex=<number> to an element:

It becomes focusable.

A user can use the tab key to move from the element with lesser positive tabindex to the next one. The exception is a special value tabindex="0" means that the element will always be last. The tabindex=-1 means that an element becomes focusable, but the tab key will always skip it. Only the focus() method will work

Post a Comment for "Jquery Focus Not Setting On Firefox"