Skip to content

Commit 5d5513f

Browse files
author
Steffen Dietz
committed
added onHide callback option
1 parent 41f2c3f commit 5d5513f

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/jquery.autocomplete.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,14 @@
593593
},
594594

595595
hide: function () {
596-
var that = this;
596+
var that = this,
597+
container = $(that.suggestionsContainer);
598+
599+
if ($.isFunction(this.options.onHide) && that.visible) {
600+
601+
this.options.onHide.call(that.element, container);
602+
}
603+
597604
that.visible = false;
598605
that.selectedIndex = -1;
599606
$(that.suggestionsContainer).hide();
@@ -602,7 +609,7 @@
602609

603610
suggest: function () {
604611
if (this.suggestions.length === 0) {
605-
this.options.showNoSuggestionNotice ? this.noSuggestions() : this.hide();
612+
this.options.showNoSuggestionNotice ? this.noSuggestions() : this.hide();
606613
return;
607614
}
608615

@@ -631,7 +638,7 @@
631638
html += '<div class="' + className + '" data-index="' + i + '">' + formatResult(suggestion, value) + '</div>';
632639
});
633640

634-
this.adjustContainerWidth();
641+
this.adjustContainerWidth();
635642

636643
noSuggestionsContainer.detach();
637644
container.html(html);

0 commit comments

Comments
 (0)