JQuery UI Autocomplete - How to select an item and mantain the label (not the value) in the input text
Since I just had to solve this too. I thought I would show my solution. IMHO it is cleaner since you don't need the separate OnSelect and OnFocus functions. (though it really does the same thing as what rperson ended up doing)
$('#txtCidade').autocomplete({
source: availableTags,
focus: function(event, ui) {
$(this).val(ui.item.label);
return false;
},
select: function(event, ui) {
$('#hidCidade').val(ui.item.value);
$(this).val(ui.item.label);
return false;
}
});