无法获得 jquery 自动完成样式
我有 jquery 自动完成示例在测试页面上运行,但似乎无法设置下拉列表样式。它只是显示为带有 li 项的普通 ul(而不是示例中带有列表的白色背景框)。我已经单独尝试过这个并使用雷德蒙德主题,对我可能做错了什么有什么想法吗?我在 firebug 中看到了 redmond 样式表,因此页面正在加载它们。
js(工作)
$(document).ready(function() {
$("input").autocomplete({
source: ["c++", "java", "php", "coldfusion", "javascript", "asp", "ruby"]
});
});
css/js 包括
<script src="/public/javascripts/jquery-1.6.2.js'"></script>
<script src="/public/javascripts/jquery-ui-1.8.14.custom.min.js"></script>
<script src="/public/javascripts/ac.js"></script> // where the above js is
<script src="/public/javascripts/jquery.tools.min.js"></script>
<link rel="stylesheet" type="text/css" media="print" href="/public/stylesheets/redmond/jquery.ui.all.css"/>
这里是输入:(
<input name="searchString" type="text" class="searchbox ui-autocomplete" id="autocomplete"/>
编辑:添加了 CSS,在编写问题时忽略了这一点)
I have the jquery autocomplete example working on a test page, but can't seem to get the dropdown list styled. It just shows up as an ordinary ul with li items (not the white background box with a list as in the example). I have tried this alone and with the redmond theme, any thoughts on what I might be doing wrong? I see the redmond stylesheets in firebug, so the page is loading them.
js (working)
$(document).ready(function() {
$("input").autocomplete({
source: ["c++", "java", "php", "coldfusion", "javascript", "asp", "ruby"]
});
});
css/js includes
<script src="/public/javascripts/jquery-1.6.2.js'"></script>
<script src="/public/javascripts/jquery-ui-1.8.14.custom.min.js"></script>
<script src="/public/javascripts/ac.js"></script> // where the above js is
<script src="/public/javascripts/jquery.tools.min.js"></script>
<link rel="stylesheet" type="text/css" media="print" href="/public/stylesheets/redmond/jquery.ui.all.css"/>
here is the input:
<input name="searchString" type="text" class="searchbox ui-autocomplete" id="autocomplete"/>
(edit: added CSS, overlooked this when writing the question)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
下载主题并包含主题的 CSS。
您可以在此处查看主题,然后从下载页面,方法是在右侧栏中选择您想要的主题。
编辑:看起来您正在使用旧的 jQuery 自动完成插件已停止使用。如果您愿意,可以尝试使用以下 CSS。不过,我强烈建议您使用 jQuery UI 自动完成功能。
Download a theme and include the theme's CSS.
You can see the themes here, and just download them from the download page by selecting the theme you want in the right-hand bar..
Edit: It looks like you're using the old jQuery auto-complete plug-in which has been discontinued. You can try the following CSS for that if you wish. I STRONGLY recommend you use the jQuery UI autocomplete however.
在您的应用程序中使用以下主题,它应该可以工作(将其添加到您的母版页/模板中或您实现自动完成功能的页面上。)
jquery.ui.theme.css
Use below theme in your application and it should work (add it in your master page/template OR on the page where you implement auto-complete feature.)
jquery.ui.theme.css