Bug Tracker

Opened 9 years ago

Closed 9 years ago

Last modified 7 years ago

#8678 closed bug (worksforme)

.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?

Change History (7)

comment:1 Changed 9 years ago by addyosmani

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.

Last edited 9 years ago by addyosmani (previous) (diff)

comment:2 Changed 9 years ago by juancastillo@…

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.

comment:3 Changed 9 years ago by timmywil

comment:4 Changed 9 years ago by timmywil

Component: unfiledevent

comment:5 Changed 7 years ago by carlmcdade@…

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;

}

});

comment:6 Changed 7 years ago by anonymous

Here's a jsfiddle of the problem

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

comment:7 Changed 7 years ago by carlmcdade@…

Sorry about that. The url pasted was not correct

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

Note: See TracTickets for help on using tickets.