tags:

views:

17

answers:

1
+1  A: 

I think the problem is related to alert().

When the alert box is closed, the focus is given to the control which was last focused by the user. This is my observation. Remove alert from the code at http://jsfiddle.net/GQyHp/1/ which is created by patrick and you'll see it will work.

So, not using built-in alert, instead using a fancy box for example may be a solution.

Zafer
+1 For good advice to avoid `alert()`. Chrome's behavior is very strange. After logging, it seems that if you place the `$(this).blur()` before the `alert()`, the alert never gets called, but the code runs past it like normal. Also, all the logs are fired twice, as though the focus was placed back into the `lastname` field. http://jsfiddle.net/GQyHp/2/
patrick dw
Thanks! Didn't think about the focus going from the field to the popup, but that makes sense. I decided on displaying an alert message on the page itself next to the field instead of some sore of custom popup. In the end that turned out to be a much cleaner solution and doesn't break the users 'flow' as much as a popup they need to get rid of.
Alec