自动填充功能未按预期工作

时间:2013-08-06 11:39:50

标签: jquery

我在执行jsp页面时收到autocomplete is not a function

也许这是我忽略的简单事情

'$('selector').autocomplete({source:myarray});'

脚本标签

'<script type="text/javascript" src="js/plugins/jquery-1.7.min.js"></script>
<script type="text/javascript"
    src="js/plugins/jquery-ui-1.8.16.custom.min.js"></script>
<script type="text/javascript" src="js/plugins/jquery.validate.min.js"></script>
<script type="text/javascript" src="js/plugins/jquery.colorbox-min.js"></script>
<script type="text/javascript" src="js/custom/general.js"></script>'

1 个答案:

答案 0 :(得分:2)

确保您的文档具有此常规格式和顺序。该错误可能是由于未加载自动完成插件引起的。

<html>
<head>...</head>
<body>
<div>
body stuff
</div>
<script src="..../jquery.js"></script>
<script src="..../jqueryui.js"></script>
<script>
var myArray = ['foo', 'bar'];
$('selector').autocomplete({source:myarray});
</script>
</body>
<html>