#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 12 years ago by
Priority: | undecided → low |
---|---|
Resolution: | → worksforme |
Status: | new → closed |
comment:2 Changed 12 years ago by
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 12 years ago by
blur removes focus. See http://api.jquery.com/blur and http://api.jquery.com/focus
comment:4 Changed 12 years ago by
Component: | unfiled → event |
---|
comment:5 Changed 10 years ago by
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;
}
});
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.