Thu, 01 Jun 2006

IE .focus() problem

Another problem I just came across was the .focus() call not working in IE after adding a new INPUT element. The page I'm working on uses a input box to type in a product number, does a lookup and if it finds the product it provides a quantity box and if not displays an error along with the input box again. After the input/quantity box is created and displayed I call .focus() so that the user can continue typing in products/quantities without having to use the mouse and select the input box. In IE this seems to not work as the .focus() call doesn't seem to be doing anything. I did some searching and was able to fix the problem by adding a .select() call after the .focus() call. This seems to have fixed the problem and it's working quite well now.

posted at: 17:29 | path: /general | permanent link to this entry


Powered by PyBlosxom | RSS 2.0