jQuery UI autocomplete: enforce selection from list without modifications

后端 未结 2 966
挽巷
挽巷 2021-01-04 19:21

I am using the custom binding provided in Autocomplete combobox with Knockout JS template / JQuery

I need to enforce that the user must select a value in the autocom

2条回答
  •  失恋的感觉
    2021-01-04 20:04

    This is an older post, but I think it's mildly incomplete from a UX perspective, due to the focus issue (it doesn't make the change until focus is removed from the input, in this case '#artist', fairly annoying), so I would add:

       select: function (event, ui) {
            $("#artist").attr("disabled", false);
        }
    

    so (let's assume it's a button we're trying to enable) that the user sees the enabled object immediately upon selection.

提交回复
热议问题