Skip to content Skip to sidebar Skip to footer

How To Activate Onblur Only If Two Divs Are Out Of Focus Jquery:javascript

For an autosuggest i have one div for the input tag and another for the suggestions div...i want the suggestions div to disappear after either 1) an element is selected in the sug

Solution 1:

Perhaps something like this will solve your problem. We only need to monitor the blur of search box because clicking out of it (even on suggestions) will trigger the hide event.

http://jsfiddle.net/9Yt9L/3/

$('#search').focus(function() {
    $('#suggestions').slideDown();
});

$('#search').blur(function() {
    $('#suggestions').slideUp();
});

$('#suggestions div').click( function() {
    $('#search').val($(this).html());
});

Post a Comment for "How To Activate Onblur Only If Two Divs Are Out Of Focus Jquery:javascript"