jQuery UI autocomplete select event not working with mouse click

前端 未结 9 852
星月不相逢
星月不相逢 2020-12-28 15:09

I have a list of links, and I have this search box #reportname. When the user types in the search box, autocomplete will show the text of the links in a list.



        
9条回答
  •  孤城傲影
    2020-12-28 15:54

    This may be a bit farshot, but I had a similar situation where selecting an autocomplete value left the input field empty. The answer was to ignore the "change" events (as those were handled by default) and replace them with binds to "autocompletechange" events. The "change" event gets triggered before the value from autocomplete is in the field => the field had "empty" value when handling the normal "change" event.

    // ignore the "change" event for the field
    var item = $("#"+id); // JQuery for getting the element
    item.bind("autocompletechange", function(event, ui) { [call your handler function here] }
    

提交回复
热议问题