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

后端 未结 14 1975
佛祖请我去吃肉
佛祖请我去吃肉 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:22

    Based on Mathieu Steele answer, instead of using this:

    input.val( $("#combobox option:selected").text());
    

    I use this:

    input.val( $(select).find("option:selected").text());
    

    Widget is now reusable and DRY :)

提交回复
热议问题