js autocomplete自动填充数据

依赖js

jquery.ajaxQueue.js

jquery.autocomplete.css

jquery.autocomplete.js

jquery.bgiframe.min.js

jquery.js

运用方式:

$("#agentName1").autocomplete(接口地址,{

dataType: "json",

minChars: 0,

width: 310,

delay :1,

autoFill :true,

matchContains: true,

highlightItem: false,

parse: function(data) {

return $.map(返回json数据, function(row) {  

return {  

data: row,  

value: row.字段名,  

result: row.字段名 

}  

});  

}, 

formatItem: function(item) {

return item.字段名;

}

}).result(function(e, item) {

                            --给文本赋值

$("#id").val(item.字段名);

});

猜你喜欢

转载自15801718321.iteye.com/blog/2315430