I wish to determine when an HTML element and it's children lose focus when the user clicks away from the element. Eg:
<div id="boxA">
<ul>
<li>x</li>
<li>y</li>
<li>z</li>
</ul>
</div>
<div id="boxB">
...
</div>
At the moment I have:
$("#boxA").live('blur', function() { hideFunction(); });
However, this does not work. If I click any element within Box A, it loses focus, but I only want it to happen when Box B is clicked or anywhere else on the page.
Edit & Solution
I found this solution on Stack Overflow. It works for me: