我想实现JQuery的自动完成功能到网站上的输入字段。检查员给我一个错误,说:Jquery自动完成功能不是一个功能
“Uncaught TypeError:$(...)。autocomplete不是一个函数”。
我相信问题可能与我的脚本标记的顺序有关,但到目前为止,我所尝试的所有内容都无法正常工作。这里是我的内容:
<head>
<title></title>
<link href="http://code.jquery.com/ui/1.10.2/themes/smoothness/jquery-ui.css" rel="Stylesheet">
<script src="~/Scripts/jquery-1.10.2.min.js"></script>
<script src="http://code.jquery.com/ui/1.10.2/jquery-ui.js"></script>
</head>
<body>
<script type="text/javascript">
var schools = new Array();
$(document).ready(function() {
$("#school").autocomplete ({
minLength: 2,
source: schools,
select: function (e, ui) {
e.target.value = ui.item.label;
$("#schoolValue").val(ui.item.value);
e.preventDefault();
}
});
</script>
</body>
对不起,我错过它复制到我的职务。在我的实际代码中,它已被正确关闭。你有什么其他的建议? – Christian
是的,我会检查旁边,以确保jqueryui完全加载,然后再尝试使用它。 – AtheistP3ace