autocomplete + select
autocomplete + select
Hi at all
I'm using jquery autocomplete to fill a textbox with some text but I need to get the ID of the item too
for this purpose I thought to use the on select event to fill an hiddend field
the problem is that the on select event is never fired
this is my code
- $(function() {
$('input#<%= tblNewInsert.FindControl("nazioni").ClientID %>').autocomplete({
source: function(request, response) {
$.ajax({
url: "offerte.aspx/fillJson",
data: "{ 'descrizione': '" + request.term + "', 'tabella': 'nazioni', 'campo': 'paese' }",
dataType: "json",
type: "POST",
contentType: "application/json; charset=utf-8",
select: function(event, ui) { alert("never fired"},
success: function(data) {
response($.map(data.d, function(item) {
return {
value: item.descrizione
}
}))
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
alert(textStatus);
}
});
},
minLength: 1
});
});
what is wrong?
thank you
Marco