Mike
Mike

Reputation: 5499

Why doesn't this event unbind using jQuery?

I have seen similar questions but I can't figure out what I am doing wrong here. The dropdown is shown after an ajax call completes successfully then I want to hide it when a user clicks anywhere. I would like to remove the event though because there is no need to hide it if it is already hidden.

        dropDown.slideDown('fast');
        $(document).bind('click.test', function() {
            alert('click');
            dropDown.slideUp('fast');
            $(document).unbind('click.test');
        });

Any thoughts?

Upvotes: 0

Views: 99

Answers (1)

SLaks
SLaks

Reputation: 887275

You can call the one method instead.

Upvotes: 2

Related Questions