jquery autocomplete get selected item text

后端 未结 4 578
傲寒
傲寒 2021-02-07 04:22

I am wondering how to grab the selected item\'s text value on jquery autocomplete.

I have initialised jquery as following :

$(document).ready(function ()         


        
4条回答
  •  孤独总比滥情好
    2021-02-07 04:58

    The ui parameter has an item property with the selected text

    function AutoCompleteSelectHandler(event, ui)
    {               
        var selectedObj = ui.item;              
        alert(selectedObj.value);
    }
    

    source: http://jqueryui.com/demos/autocomplete/#event-select go to tab "Events" and then event "Select"

提交回复
热议问题