11

I am making a search input on focus it shows a div with options with following:

$("#search").focus(function(){

$("#options").fadeIn("fast");

});

I am hiding the div back with this function

 $("#search").blur(function(){

$("#options").fadeOut("fast");

});

now the problem is even when user clicks at any checkbox in #option it hides. How I can stop it hidding when clicking checkboxes?

3
  • i missed ); on both functions pardon me Commented May 27, 2012 at 17:16
  • This question has already been answered on stackoverflow.com/questions/152975/…. You have there several possible solutions to address your issue. Commented May 27, 2012 at 17:19
  • please provide the html markup. Commented May 27, 2012 at 17:32

1 Answer 1

3
 $("#search").blur(function(e){
   e.stopPropagation()
   $("#options").fadeOut("fast");
});
Sign up to request clarification or add additional context in comments.

1 Comment

$(this).children('input[type=checkbox]').on('click', function(){e.stopPropagation();}); // isn't this missing in the blur listener?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.