Here is my code
jquery code
$(\"input#shopName\").autocomplete({
source: \"getShop.php\",
minLength: 2
});
The JSON value r
$("input#shopName").autocomplete({
source: "getShop.php",
minLength: 2,
select: function(event, ui) {
$("#theHidden").val(ui.item.id)
}
});
See http://jqueryui.com/demos/autocomplete/#event-select
Use the following to get chosen value onClick
$( "#searchText" ).bind( "autocompleteselect", function(event, ui) {
console.log(ui['item']['value']);
});
This works for me fantastically:
$(ui)[0].item.label
$(ui)[0].item.value