Wednesday, 18 September 2013

function select with autocomplete jquery does not work

function select with autocomplete jquery does not work

I use function "autocomplete" of jquery.here is my code below, the problem
that the select function does not work
$(function () {
var productId = 0;
var productLabel;
$("#autocompleteInput").autocomplete({
source: function (req, add) {
$.getJSON(urlresourceproduct, req, function (data) {
add($.map(data.data, function (item) {
return {
label: item.tuttiProdottis,
val: item.id
};
}));
});
},
minLength: 2,
select: function (event, ui) {
productId = ui.item.val;
productLabel = ui.item.label;
},
close: function (event, ui) {
alert(productId);
drawChart();
return false;
}
}).focus(function () {
$("#autocompleteInput").val("");
return false;
});
});
});

No comments:

Post a Comment