最近因项目需求,要新增一个下拉框选项(可输入,并自动匹配),并且要求能支持低版本IE浏览器。去网上找了很多资料发现要么没有效果,要么就是一大堆代码,并不符合我的需求。
不多说,直接上代码。
JSP:
<table class="table_inline">
<td class="td_other">款式编码:</td>
<td class="td_other"><input type="text" id="ksbm">
<!-- <datalist id="codes">
</datalist> -->
</td>
</table>
$.post("URL",function(reslut){
var data= eval("("+reslut+")");
$("#ksbm").autocomplete(data,{
max:10000,
matchContains:true,// 输入自动匹配
minChars:0
});
});
后台代码:
public void getAllCodes() throws IOException {
request.setCharacterEncoding("utf-8");
res