Home › Forums › JavaScript › On body click, hide search › Re: On body click, hide search
April 21, 2013 at 6:37 am
#132568
chrisburton
Participant
I ended up getting it working but can any Javascript professionals check out my code?
$(‘.find’).click(function(event) {
event.preventDefault();
$(‘.search’).slideDown(‘slow’);
});
$(‘.find’).click(function(e) {
e.stopPropagation();
});
$(document).click(function() {
$(‘.search’).slideUp(‘slow’);
});
Update: Damn. I just noticed that if I go to click in the input, it hides the search bar. This is tricky.