I am using jquery-ui autocomplete.
I want result list of the autocomplete search stayed open and closed when the area outside of the 'autocomplete text input area'&'search result list'.
I referenced keep ui autocomplete open at all times.
Now It keeps open. but can't find out how to close it when outside area is clicked.
http://jsfiddle.net/9r3avhoe/6/
$("input").autocomplete({
source: ["Apple", "Boy", "Cat"],
minLength: 0,
response: function(event, ui) {
//console.log(ui);
},
select: function(event, ui) {
addObject(ui.item.value);
return false;
},
focus: function(event, ui) {
return false;
},
close: function(event, ui) {
if (!$("ul.ui-autocomplete").is(":visible")) {
$("ul.ui-autocomplete").show();
$( "#search" ).focus();
}
}
});