I want to determine when the HTML element and its children lose focus when the user clicks on the element. For instance:
<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 on an element in block A, it loses focus, but I want this to happen only when they press button "B" or somewhere else on the page.
Editing and Solution
I found this solution in Stack Overflow. This works for me:
Use jQuery to hide the div when the user clicks on it
source share