Forum Moderators: open
In a form, I have a text input field and I have a select box. When the input field is in focus, the select box is shown. No problems there. Now, when the user clicks out of the input field (i.e. onblur) I want the selectbox to be hidden, unless the user is actually clicking on the selectbox.
That is, at the onblur event of the input field, the selectbox should be hidden, unless the new focus is on the selectbox.
How can I do this? The problem is that the onblur event of the input field is activated before the onfocus event of the selectbox. So, when the onblur event fires, the selectbox isn't actually in focus.
The only way around this that I can think of is to have an onfocus event for every element on the page that is NOT the selectbox and then hide the selectbox when any of those onfocus events fire. But that's a hassle! Can anyone think of a tidier solution?
Thanks,
Prem.