Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我认为您可以使用change事件并检查是否ui.item为空,然后您可以将输入设为空并显示警报或自定义消息,例如(只是一个想法)
change
ui.item
change: function( event, ui ) { if(ui.item==null) { this.value=''; alert('Please select a value from the list'); // or a custom message } }
演示。
更新:如果值已更改,则在字段模糊时触发 更改事件。