[Solved] Click outside of div and more [duplicate]


$(function() {
    $('#loginBtn, #loginArea').on('click', function(e) {
        $('#loginArea').show();
        e.stopPropagation();
    });
    $('body').on('click', function() {
        $('#loginArea').hide();
    });
});

If the click is within the login area or on the button, then the event will not make it to the second handler to hide the login area.

solved Click outside of div and more [duplicate]