Yeah, there is a bit more to this, as I found out when I got curious and
started experimenting with it. :-)

I've needed to do this same thing myself, so I wrote a little plugin you may
find useful:

http://mg.to/jquery/focuswatch/

Let me know if that is something like what you're looking for. I haven't
done thorough browser testing, but did a quick check of
IE7/FF3/Safari3/Opera9.

-Mike

> From: C. Feldmann
> 
> I have a form which is loaded into a div through an ajax 
> call. I would like to hide the form again as soon as the 
> focus is lost. The form consists of inputs, textareas and selects.
> I have tried .blur() both on the form and the parent div, but 
> that just didn't react. I can obviously bind a .blur to an 
> input field, but that doesn't help, since I only want to 
> trigger my function if the cursor is in none of the form fields.
> 
> If there was a way for me to traverse through the form fields 
> and check if one is focused it would be great. I googled for 
> a possibility to determine if an input, select or textarea is 
> "under focus", but I couldn't find anything useful.
> 
> Alternatively it would be great to find out what triggers 
> .blur() events on non form-elements (i.e. divs for forms themselves).
> 
> How can I solve determine if a form is not being "used" anymore?

Reply via email to