How to close modal on next click after open?
<p>I have the link with class <code>control</code> on which rises div with class <code>popup</code>. The problem is on how to close this div on the next click if this click is outside the div? At the moment this two events fires at the same moment and as a result modal don't appear.  How to close this modal only on the next click.</p>

<pre><code>jQuery(document).ready(function(){
    jQuery('body').on('click', function(event){
        var menu_popup = jQuery('div.popup[data-open-status="true"]');

        if(menu_popup.has(event.target).length === 0)
            menu_popup.hide().attr('data-open-status', 'false');
    });

    jQuery('a.control').click(function(event){
        event.preventDefault();
        jQuery('div.popup').show().attr('data-open-status', 'true');
    });
});
</code></pre>
