设置 autocomplete 只能选择下拉框的内容
$.fn.extend({
authorizeditemlist: function(options) {
return this.each(function() {
var sender = $(this);
var url = "search.asp";
sender.unautocomplete()
.autocomplete(url, {
max: 0
,mustMatch:true
,minChars: 0
,width: 180
,matchContains: "word"
,autoFill: false
,extraParams: {
regionid: sender.closest("table").find("select[name=id]").val()
}
,formatItem: function(row){return row[1];}
,formatResult: function(row){return row[1];}
})
.result(function(event, data, formatted) {
var tr = $(this).closest("tr");
if(data) tr.find("input[name=id]").val(data[0]);
//不加此判断会报错:data[0]为null
});
});
}
});