custom ui object attribute JqueryUI Autocomplete
var carMake = [{
"make": "Smart",
"id": '200038885'
}, {
"make": "Bomb",
"id": '200038885'
}, {
"make": "Volkswagen",
"id": '200000238'
}];
function addlabel(row) {
row.label = row.make;
row.value = row.id;
}
carMake.forEach(addlabel);
$("#vehicle_make").autocomplete({
source: carMake,
delay: 0,
minLength: 1,
autoFocus: false,
select: function (event, ui) {
$(this).val(ui.item.make);
return false;
}
});