webwrks
webwrks

Reputation: 11918

jQuery Hide Toggeled Div On Document.click

I currently have the following code:

$(function(){
  $('#btn_signIn').click(function(){
    $('#div_signInBox').toggle("fast");
  });
});

I need to hide the div_signInBox toggled div anytime any other part of the window is clicked...

Thanks!

Upvotes: 0

Views: 371

Answers (1)

Andy
Andy

Reputation: 30135

Is this what you want?

$(function() {
    $('#div_signInBox,html').click(function() {
        if ($(this).is('#div_signInBox')) 
            return false;

        $('#div_signInBox').toggle("fast");
    });
});

Upvotes: 1

Related Questions