How can I override default behavior of displaying item label on the input when hovering/focusing on the items results?
Example not working:
JavaScript:
$('#ac').autocomplete({
source : ["hello", "how", "do", "you", "do"],
focus: function(event, ui){
console.log("print")
$(this).val('my custom label to show in input');
}
})
HTML:
<input type="text" id="ac"/>
Prevent the default action of the event, which is to replace the input’s value with the focused item’s value:
Example: http://jsfiddle.net/4jJyb/