Close on document, but not on this element.
$(document).on('click', function(e){ if ($(e.target).closest('.user-sign-in-form').length === 0) { $('.user-sign-in-form').fadeToggle(); } });