jquery autocomplete get selected item text

后端 未结 4 716
傲寒
傲寒 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条回答
  •  Happy的楠姐
    2021-02-07 04:57

    // list of clients
            $( "#client" ).autocomplete({
            source: "lib/getClientList.php",
            minLength: 2,
            select: function(event, ui) {
                alert(ui.item.value);
                 }
            })
    

    ;

    The ui.item.value is the reference that jquery utilizes to assign a value to the input

提交回复
热议问题