How to hide div with jquery when clicking anywhere except one div?

I do the search input in focus, it shows a div with parameters with the following:

$("#search").focus(function(){ $("#options").fadeIn("fast"); }); 

I hide the div back with this function

  $("#search").blur(function(){ $("#options").fadeOut("fast"); }); 

the problem occurs even when the user clicks on any checkbox in #option that is hiding. How can I stop it when you click the checkboxes?

+8
javascript jquery
source share
1 answer
  $("#search").blur(function(e){ e.stopPropagation() $("#options").fadeOut("fast"); }); 
+3
source share

All Articles