jQuery UI Autocomplete with hybrid text/id search

后端 未结 4 584
野性不改
野性不改 2020-12-14 04:31

I\'m having a lot of trouble making jQuery\'s autocomplete widget work for me. I am using a list of key/value pairs from a server.

I have the following requirements

4条回答
  •  执念已碎
    2020-12-14 04:57

    You can use event.preventDefault

    Collect your selected values through ui.item.label or ui.item.value and get the needed value and set it to the same textbox.

    var idNameCombo = ui.item.label;
                event.preventDefault();
                $("#mID").val(idNameCombo.split(",")[0].trim());
    

提交回复
热议问题