我已经阅读了有关jQuery 3.3.1和jQuery-UI 1.12.1的所有帖子,但无法获得解决方案。这是我的代码,无法正常工作。
<link href="lib/jquery-ui/themes/base/jquery-ui.css" rel="stylesheet" />
<link href="lib/bootstrap/dist/css/bootstrap.css" rel="stylesheet" />
<div class="ui-widget">
<span>Enter Language Name: </span><input id="Language">
</div>
<script src="lib/jquery/dist/jquery.js"></script>
<script src="lib/jquery-ui/jquery-ui.js"></script>
<script src="lib/bootstrap/dist/js/bootstrap.js"></script>
<script>
var tech = [
"Asp",
"Basic",
"Java",
"Php",
"Typescript",
"Ruby",
"Python",
"Angular"
];
$('#Language').autocomplete({
data: tech
});
</script>
答案 0 :(得分:0)
data
设置中没有autocomplete()
属性。如果要提供要在控件中使用的值数组,则需要使用source
。我建议您阅读documentation。
var tech = [
"Asp",
"Basic",
"Java",
"Php",
"Typescript",
"Ruby",
"Python",
"Angular"
];
$('#Language').autocomplete({
source: tech
});
<link href="https://code.jquery.com/ui/1.12.0/themes/smoothness/jquery-ui.css" rel="stylesheet" />
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet" />
<div class="ui-widget">
<span>Enter Language Name: </span><input id="Language">
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>