How do you set a default value with jquery auto complete combobox?

后端 未结 14 1926
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-28 19:01

When using the jquery ui autocomplete combobox, can you set a default value for the combobox?

14条回答
  •  南方客
    南方客 (楼主)
    2020-12-28 19:25

    Answer #1 is very close, but you cannot hard-code the element ID if you want to keep the function generic. Add this line instead and enjoy!

    input.val(jQuery("#"+select.attr("id")+" :selected").text() );
    

提交回复
热议问题