Disable mouse click when out of div
<p>Hi i have a div of a form. i want that disable click event when mouse is out of the div. So i tried this but it is not working ot of div is still clickable. Any idea??</p>

<pre><code>var flag = false;
$("#foo").live("mouseenter",function(){
    flag = true;
}).live("mouseleave",function(){
    flag = false;
})

$(document).click(function(){
    if(!flag)
         return false;
});
</code></pre>
