I have a autocomplete on the page using jQuery UI and here is the JSON:
[ {"label":"test1", "value":"1"},
{"label":"testtest", "value":"6"},
{"label":"test2", "value":"8"} ]
The default action of autocomplete will grab the value of the item and place into the input box. Is there a way I can stop it? Instead have two separate actions: one inject to a hidden box (with value) and the other to the input box with (label).
$.getJSON('index.php?controller=account&action=getusers', function(data) {
tempJson = data;
$(".auto-search").autocomplete({
minLength: 2,
dataType: 'json',
source: tempJson,
select: function (event,ui) {
$('input[name="user-id"]').val(ui.item.value);
}
});
});
Do you mean something like: