这段代码有什么问题?当我输入一个单词时,建议不会以正确的形式出现。
还有什么我应该加载吗?
更新的代码:
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
</head>
<body>
<form>
<div class="list">
<div class="item">
<input type="hidden" class="user-id" id="h1"/>
<input type="text" class="user-name" id="t1"/>
</div>
</div>
</form>
<script>
var users = [
{"label":"User 1","value":"User 1","userId":1},
{"label":"User 2","value":"User 2","userId":2}
];
$(".user-name").autocomplete({
source: users,
autoFocus: true,
delay: 0,
});
</script>
</body>
</html>
答案 0 :(得分:0)
添加
时,它适用于我 <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
请参阅此FIDDLE