Hi,
There are two textboxes, one(id:sites) is to display a dropdown list when user input any letters, another(id:siteID) is to catch the value when selecting an item from dropdown list. see example at: http://jqueryui.com/demos/autocomplete/
Below is my code:
var siteNames =new Array("ASDA","Tesco","Boots");
var siteIDs =new Array(1,3,7);
for (i=0; i<siteIDs.length;i++){
$( "#sites" ).autocomplete({
source: siteNames,
select: function() {$('#siteID').val(siteIDs[i])}
});
}
the result is siteID box got nothing. but if setting siteIDs[2], the siteID box will display 7. Thus, i think the problem is jquery can't work with Javascript.
Can anyone help me? Many thanks!