JQuery中的自动完成不显示提示
Autocomplete in JQuery does not show hints
我在JQuery中的自动完成有问题。这是我的autoComplete.html文件:文本字段出现在页面上,但在键入时不会显示提示。我做错了什么?
编辑:我已经修改了@Praveen Kumar对我代码的回答,但TextBox仍然没有显示提示。
第2版:脚本链接中出现问题。代替
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css"></link>
应该有:
<link rel="stylesheet" href="http://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css"></link>
现在一切正常。现在我的代码看起来是这样的:
<head>
<meta charset="utf-8"></meta>
<meta http-equiv="X-UA-Compatible" content="IE=edge"></meta>
<meta name="viewport" content="width=device-width, initial-scale=1"></meta>
<meta name="description" content=""></meta>
<meta name="author" content=""></meta>
<title>Gigs Map Inserting</title>
<!-- Bootstrap Core CSS -->
<link href="http:/css/bootstrap.min.css" rel="stylesheet"></link>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css"></link>
<!-- Linki do skryptow -->
<script>
$(document).ready(function() {
var availableTags = [
"FirstOption",
"SecondOption",
"ThirdOption"
];
$("#tags").autocomplete({
source: availableTags
});
});
</script>
<script type="text/javascript" src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js" ></script>
</head>
<body>
<div th:class="form-group">
<label class="col-md-3 control-label">Tags: </label>
<input class="form-control" id="tags" name="tags" />
</div>
更改包含顺序,更新对jQuery文件的引用:
<script type="text/javascript" src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js" ></script>
添加source
:
$("#tags").autocomplete({
source: availableTags
});
代码段
$(document).ready(function() {
var availableTags = [
"FirstOption",
"SecondOption",
"ThirdOption"
];
$("#tags").autocomplete({
source: availableTags
});
});
@import url("//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css");
<script type="text/javascript" src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js" ></script>
<div th:class="form-group">
<label class="col-md-3 control-label">Tags: </label>
<input class="form-control" id="tags" name="tags" />
</div>
相关文章:
- 单元格的工具提示或标题不显示超过2000个字符
- 如何更改已显示的工具提示
- 显示数字键盘的Phonegap-js提示
- 如何在jQuery点击函数中添加并显示引导工具提示
- 如何在将鼠标悬停在提交/锚点上时检查复选框是否已选中,并显示提示用户这样做的警报
- 双击谷歌地图显示提示框不起作用
- 关闭窗口前显示提示
- 在 Vaadin 7 中创建的 onbeforeunload 函数返回空字符串在 IE 10 中仍然显示提示
- 脚本中未显示提示
- 悬停时显示提示消息
- 如何在刷新页面时显示提示消息
- Javascript 不显示提示
- 如何使用JavaScript在刽子手游戏中还剩3个猜测(生命)时显示提示
- 在Angular中隐藏/显示提示文本
- Html, javascript:滚动列表框项目-并为每个项目显示提示
- 24小时内仅点击一次,显示提示框
- JQuery中的自动完成不显示提示
- 如何在元素附近的适当位置显示提示
- 如何在 html 表单域中显示提示
- jquery ui自动完成显示提示