Skip to main content

Bug Tracker

Side navigation

#8678 closed bug (worksforme)

Opened March 28, 2011 02:10PM UTC

Closed March 28, 2011 07:08PM UTC

Last modified November 02, 2012 04:47PM UTC

.focus not working in Firefox 4

Reported by: anonymous Owned by:
Priority: low Milestone: 1.next
Component: event Version: 1.5.1
Keywords: Cc:
Blocked by: Blocking:
Description

$('#textbox').focus(); does not seem to work in Firefox 4. I have tested a script with this in Chrome, and it works OK. This is probably a Firefox 4 issue, not necessarily a jQuery one?

Attachments (0)
Change History (7)

Changed March 28, 2011 07:08PM UTC by addyosmani comment:1

_comment0: .focus() is working fine for me in FF4 without any issues. Depending on what you are trying to achieve, see here for a live example where clicking on a link set to focus the input textbox is working fine. http://jsfiddle.net/addyosmani/NmZ6z/. You'll notice that the focus handler is called with a message being appended to the document body, confirming that everything is working as expected.1301339375028219
priority: undecidedlow
resolution: → worksforme
status: newclosed

Thanks for submitting a ticket to the jQuery Bug Tracker .focus() is working fine for me in FF4 without any issues. Depending on what you are trying to achieve, see here for a live example where clicking on a link set to focus the input textbox is working fine. http://jsfiddle.net/addyosmani/NmZ6z/. You'll notice that the focus handler is called with a message being appended to the document body, confirming that everything is working as expected.

Changed April 13, 2011 02:26PM UTC by juancastillo@bftg.com comment:2

My problem is that I have a textbox intended to hold numeric characters, if the user types a non-numeric character I will alert and focus back on the field. I'm using the jquery blur() event to put focus back on the field and it doesn't work.

Changed April 13, 2011 02:42PM UTC by timmywil comment:3

Changed April 13, 2011 02:42PM UTC by timmywil comment:4

component: unfiledevent

Changed November 02, 2012 01:29PM UTC by carlmcdade@gmail.com comment:5

This bugs announced "working for me" is based on invalid usage. In focus() does not work if the controlling function is blur. In the following code the focus in not set to the originating text box if another text box is clicked on to trigger the blur()

$("#textbox").blur(function () {

$('body').append('focused on textbox');

if($("#textbox").val() > 24 )

{

alert('stop');

$("#textbox").focus();

return false;

}

});

Changed November 02, 2012 02:58PM UTC by anonymous comment:6

Here's a jsfiddle of the problem

http://jsfiddle.net/carlmcdade/PKM4J/

Changed November 02, 2012 04:47PM UTC by carlmcdade@gmail.com comment:7

Sorry about that. The url pasted was not correct

http://jsfiddle.net/carlmcdade/DRCzS/