输入框自动补全js代码

版权声明:快乐源于分享!!!!!! https://blog.csdn.net/GaojbSunny/article/details/76987370
 $('.searchIpt').keyup(function(e){
if(event.which >= 37 && event.which <=40 || event.which == 13){//键盘值在37和40之间是上下键,13时是enter键
return;
}
$.get("/backstage/getDebtors?keyword=" + $(this).val(), function(result){
$('.searchIpt').AutoComplete({
       'data': result.debtors, //debtors是后台传入的数据
       'itemHeight': 24,//高
       'width': 210 //宽
   }).AutoComplete('show');

});



其中要引入autocomplete.js插件

猜你喜欢

转载自blog.csdn.net/GaojbSunny/article/details/76987370