Closed
Description
When user select the suggestion list using keyboard, then loose the focus (click outside the input), then click inside the input again the onInvalidateSelection
work as expected.
But when user select the suggestion list using mouse, then loose the focus (click outside the input), then click inside the input again the onInvalidateSelection
simply not working
Here is my code:
$(function () {
$(document).on('focus', '.item-name', function () {
$(this).autocomplete({
minChars: 1,
preventBadQueries: false,
serviceUrl: "/ajax/inventory/goods/search",
showNoSuggestionNotice: true,
dataType: "json",
onInvalidateSelection: function (suggestion) {
console.log('on invalidate');
},
onSelect: function (suggestion) {
console.log("on select");
},
onHide: function () {
console.log("on hide")
}
});
});
});
Looks like this problem only occur if autofocus is being used with dynamically loaded element
Is there any workaround?
Metadata
Metadata
Assignees
Labels
No labels