您好,请在此处查看演示:http : //jsfiddle.net/vZtGs/ 或者请在此处使用更多选项查看我的旧回复之一:jquery autocomplete using '@'
在这里阅读:http: //jqueryui.com/demos/autocomplete/(支持其他选项和事件)
代码
$( "#autocomplete, #schoolsearch" ).autocomplete({
source: function( req, resp ) {
$.post( "/echo/json/", {
json: '["School1", "School2", "School3", "School4", "School5"]',
delay: 1
}, function(data) {
resp( data );
}, "JSON" );
},
select: function(event, ui) {
//var terms = split(this.value);
alert('Do whatever with this value man: ' + ui.item.value);
return false;
}
});