jQuery: Hide element on click anywhere else apart of the element [duplicate]

You can resort to the concept of event delegation.

$(function() {
    $(document).on('click', function(e) {
        if (e.target.id === 'div1') {
            alert('Div Clicked !!');
        } else {
            $('#div1').hide();
        }

    })
});​

Check FIDDLE

I did not understand what you meant by integrating with the other part.. This is the basic idea..

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)