Reputation: 65183
I have a jquery drop down that activates and deactivates when you click the header for the drop down
$j('#category_header').click(function() {
$j('#category_dropdown').slideToggle("fast");
return false;
});
but I want it to also close when I click anywhere on the page that isnt the drop down. How do I go about doing that?
Upvotes: 1
Views: 7684
Reputation: 65183
Got it
$j(function() {
$j('body').click(function() {
$j('#category_dropdown').slideUp("fast");
return false;
});
});
Upvotes: 0
Reputation: 1473
Look at the answer for this question: How do I detect a click outside an element?
Upvotes: 2