jQuery 自动完成功能不起作用

发布于 2024-11-08 19:04:39 字数 1512 浏览 0 评论 0原文

我从 here 获取代码,

代码不起作用,我也有 autoComplete 插件,这里是fiddle 链接到它。

有什么问题以及如何解决?

好吧,这就是我在 VS 中写的

<html>
<head>
    <title></title>
    <script src="script/jquery-1.6.1.min.js" type="text/javascript"></script>
<script src="script/jquery.autocomplete.js" type="text/javascript"></script>
    <script src="script/jquery-ui-1.8.13.custom.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {
            var availableTags = [
            "ActionScript",
            "AppleScript",
            "Asp",
            "BASIC",
            "C",
            "C++",
            "Clojure",
            "COBOL",
            "ColdFusion",
            "Erlang",
            "Fortran",
            "Groovy",
            "Haskell",
            "Java",
            "JavaScript",
            "Lisp",
            "Perl",
            "PHP",
            "Python",
            "Ruby",
            "Scala",
            "Scheme"
        ];
            $("#tags").autocomplete({
                source: availableTags
            });
        });
    </script>
</head>
<body>
    <div>
        <input id="tags" type="text" />
    </div>
</body>
</html>

,但它仍然不起作用,如果这是一个愚蠢的错误,抱歉! 还是不行

I got the code from here

the Code is not working, I have the autoComplete plugin as well, here's the fiddle link to it.

What's the problem and how can I solve it?

ok this is what I've written in VS

<html>
<head>
    <title></title>
    <script src="script/jquery-1.6.1.min.js" type="text/javascript"></script>
<script src="script/jquery.autocomplete.js" type="text/javascript"></script>
    <script src="script/jquery-ui-1.8.13.custom.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {
            var availableTags = [
            "ActionScript",
            "AppleScript",
            "Asp",
            "BASIC",
            "C",
            "C++",
            "Clojure",
            "COBOL",
            "ColdFusion",
            "Erlang",
            "Fortran",
            "Groovy",
            "Haskell",
            "Java",
            "JavaScript",
            "Lisp",
            "Perl",
            "PHP",
            "Python",
            "Ruby",
            "Scala",
            "Scheme"
        ];
            $("#tags").autocomplete({
                source: availableTags
            });
        });
    </script>
</head>
<body>
    <div>
        <input id="tags" type="text" />
    </div>
</body>
</html>

and it still doesn't work, sorry if it's a stupid mistake !
still doesn't work

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

但可醉心 2024-11-15 19:04:39

答案很晚,但我陷入了完全相同的问题。我仍然不知道为什么(因此我仍在寻找这个),但是将 jQuery 版本从 1.6.2 降级到 1.4.2 使其对我有用。

Very late answer but I got stuck on the exact same problem. I still do not know why (hence why I'm still searching for this), but downgrading jQuery version from 1.6.2 to 1.4.2 made it work for me.

白况 2024-11-15 19:04:39

好吧,

1)重新启动VS,它有时会搞砸。

2) 您需要包含要使用的所有 jquery,而不仅仅是 UI 插件

3) 请记住包含插件的顺序非常重要(JQuery 应该是 #1,然后是其他插件 - ins)

并保留一个调试器,并检查发生了什么! :)

祝你好运

okay,

1) restart VS, it has the tendency to screw up sometimes.

2) you need to include all the jquery you're going to use not just the UI plug-in

3) remember it's very important the order in which you include your plug-ins(JQuery should be #1 followed by the other plug-ins)

and keep a debugger, and check what's happening ! :)

good luck

执手闯天涯 2024-11-15 19:04:39

我猜测“fiddle”链接不起作用(以前没有使用过 - 漂亮!),因为 fiddle 页面似乎只加载了“jquery”,而不是“jqueryui”?

I'm going to guess that the 'fiddle' link doesn't work (haven't used that before - nifty!) because the fiddle page seems to only have 'jquery' loaded, not 'jqueryui'?

长途伴 2024-11-15 19:04:39

您还必须包含 jQuery UI 框架。这是小提琴
您可以在这里获取 jQuery UI

You have to include the jQuery UI framework as well. Here's the fiddle
And here's where you can get the jQuery UI

合约呢 2024-11-15 19:04:39

您需要在 Fiddle 中包含 jQuery

You need to include jQuery in your Fiddle

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文