I have a text input field, when the user typing in the field, onKeyUp() function is called and I do some processing on the content in the field. In order to set the focus and cursor back to the filed, I use the focus() function as follows:
My OS is Windows 7. focus() works correctly in Chrome 15.0, meaning if the contents of the field is already ABC, the cursor appears right after C, so if the user enters D, the contents of the field would be: ABCD.
In FireFox 8.0, the cursor appears at the beginning of the field, meaning if the contents of the field is already ABC, the cursor appears before A, so if the user enters D, the contents of the field would be: DABC.
And in IE 8.0, the focus() does not work at all! The field looses the focus completely and I need to use the mouse to set the focus back to the field.
1) Does anybody know why this function does not work properly in IE?
2) For FireFox: is there anyway, I can make the focus appears at the end of the field instead? Or on the other words is there anyway I can make the functionality the same in FireFox as it does in Chrome?