需要的css:
<link href="<c:url value="/style/jquery.autocomplete.css" />"rel="stylesheet" type="text/css">
需要的js:
<script type="text/javascript" src="<c:url value="/js/jquery.autocomplete.js" />"></script>
额外的js代码:
$(document).ready(function() {
$("#LishuBumenFirst").autocomplete(
"<c:url value='/autocomplete/getLishuBumenFirst.do' />",
{
delay:10,
minChars:2,
matchSubset:1,
matchContains:1,
onItemSelect:selectItem,
maxItemsToShow:10,
autoFill:false
}
);
});
表单:
<th width="15%">
<em>*</em>隶属部门:
</th>
<td width="35%">
<form:input path="department" maxlength="20" cssClass="txt" id='LishuBumenFirst'/>
<form:errors path="department" />
</td>