- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试让 jQueryUI 自动完成功能在本地测试页中运行。
在他们的演示页面上看起来不错: https://jqueryui.com/autocomplete/#remote
然而,当我在本地运行它时,使用完全相同的演示代码(删除了远程调用)它工作正常,除了不显示下拉框,只是一个带有丑陋的默认黑色 li 项目符号的丑陋列表:
因此,该页面上的代码之外有一些东西将 ul 格式化为更清晰的下拉菜单。我没看到。我可能可以在几分钟内自行设置样式,但我宁愿让它正常工作。
这是他们的演示代码,经过调整以在本地针对数组运行:
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>jQuery UI Autocomplete - Remote datasource</title>
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<link rel="stylesheet" href="https://jqueryui.com/resources/demos/style.css">
<style>
.ui-autocomplete-loading {
background: white url("images/ui-anim_basic_16x16.gif") right center no-repeat;
}
</style>
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script>
$( function() {
function log( message ) {
$( "<div>" ).text( message ).prependTo( "#log" );
$( "#log" ).scrollTop( 0 );
}
$( "#birds" ).autocomplete({
source: ["abc","def"],
minLength: 2,
select: function( event, ui ) {
log( "Selected: " + ui.item.value + " aka " + ui.item.id );
}
});
} );
</script>
</head>
<body>
<div class="ui-widget">
<label for="birds">Birds: </label>
<input id="birds">
</div>
<div class="ui-widget" style="margin-top:2em; font-family:Arial">
Result:
<div id="log" style="height: 200px; width: 300px; overflow: auto;" class="ui-widget-content"></div>
</div>
</body>
</html>
最佳答案
这不是您源代码中的问题,但是当您忘记在标题中添加 jquery 样式表时也会发生这种情况:
<link rel="stylesheet" ref="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
这可能对其他人有帮助。
关于javascript - jQueryUI 自动完成下拉列表缺少格式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49565801/
我正在关注 this tutorial在 jqueryui 工具提示中显示验证错误。验证工作正常,但我无法显示正确的错误消息,因为正确的属性无法有条件地链接到工具提示,如下面的示例所示: $(docu
我在 ASP.NET 页面中使用 jqGrid 并将数据注入(inject)到页面上的脚本 block 中,然后从那里加载。对于这一用例,我们需要立即在屏幕上显示大量数据。其中涉及 300~500 条
This jQuery plugin ,它允许用户在 div 中绘制矩形,适用于 jQueryUI 1.7.2。 我需要让它与 jQueryUI 1.8.4 一起工作。来自阅读widget upgra
我有一个使用 jQueryUI 可排序的列表。 我需要根据插件的“更改”事件在拖动时跟踪元素的每一步。 但它只能从缓慢到正常的阻力可靠地工作。在这些速度下,没有任何错误。但是如果用户相对较快地拖动元素
当我重复滚动某个元素时 jQuery tooltip似乎在跳来跳去。我想也许是因为它与自身发生碰撞,所以我将碰撞选项设置为none,但这没有帮助。 这是一个错误吗?我怎样才能让它不跳来跳去? 最佳答案
如果返回的 json 对象如下所示,我有一个可以正常工作的 jQuery UI Autocomplete: label:name value:name 然后它会搜索 myname,当用户选择一个时,它
我是 JQueryUI 的新手,虽然我有一个对话框正在工作,但它没有以我认为指定的大小打开。为什么定义对话框时设置宽度和高度不会影响对话框的初始大小?如何将其设为 600 像素 x 500 像素? 这
我有一个简单的任务却让我抓狂。 我的 jQuery 代码: $(document).ready(function() { $("#dialog_open").butto
我正在使用 jQueryUI 1.8,它具有自动完成功能。 到目前为止,我已经成功地在多个领域实现了自动完成功能,如下所示: $(function() { $("#auto").autocom
我使用 UL 元素创建一个菜单,我使用 jQueryUI 来显示此菜单。 Edit Translation Edit Comment Edit Bind Edit R
我正在使用最新版本的 JqueryUI 自动完成(1.8.23)。我正在使用 autoFocus : true 属性,这给我带来了一个大问题。 当我开始在输入框中快速输入文本时,autoFocus :
问题: 当使用多个标准 jQueryUI 对话框实例化时,如下所示: $("#dialog").dialog({}); $("#dialog2").dialog({}); 如果有大量内容或设置了特定高
看看这个 jsfiddle 我试图将两个按钮并排放置,其中一个按钮是动态的,并且仅在发生特定事件时才会出现(在示例中是按下另一个按钮)。但在动画转换过程中,布局有点扭曲 $('.btn-toggle'
我有以下情况: 按钮打开一个包含复选框的模式对话框。当我单击此复选框时,我希望显示另一个模式对话框(警告),但我也想保留新的复选框状态(选中或未选中)。例如,如果复选框未选中并被单击,我希望显示警告并
我目前正在使用 jQuery UI 中的模态对话框作为菜单。该菜单由一些图像组成,单击这些图像时可用作菜单项。该站点使用动态 ajax 内容来加载所请求的页面。这是我的问题:单击图像后如何关闭模式对话
我正在处理 jqueryui 自动完成 JSONP 示例:http://jqueryui.com/demos/autocomplete/#remote-jsonp 即使在他们自己的演示中,我也设法让这
我正在使用 JQueryUI 对话框并在下面创建了此函数: $(document).ready(function() { $('#dialog').dialog({
我正在使用 jqueryui 自动完成来让我的文本框为用户显示各种选项。 在本例中,我只希望用户能够从列表中选择一个值,而不是输入另一个值。 我通过以下方式实现了这一点: $('#modelNo').
使用jQueryUI Autocomplete 我想将一些其他数据附加到框中的结果列表中。例如,我的数据集可能如下所示: [ { "name": "John's wild ba
尝试使用 jQueryUI 将表格列滑出 View ,然后再返回。遗憾的是,它似乎没有保留正确的列宽和位置,因此该列最终出现在错误的位置。 我遇到的问题的提炼版本在 http://jsfiddle.n
我是一名优秀的程序员,十分优秀!