首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如果我从我的计算机(Notepad++)运行它,http://jqueryui.com/droppable/#shopping-cart上没有错误,但是"ReferenceError:$ is not defined“

如果我从我的计算机(Notepad++)运行它,http://jqueryui.com/droppable/#shopping-cart上没有错误,但是"ReferenceError:$ is not defined“
EN

Stack Overflow用户
提问于 2015-04-24 00:17:43
回答 1查看 65关注 0票数 0

我刚刚开始学习JQuery,并找到了一个对我正在做的事情(droppable,draggable,clone等)有用的例子。它在网站上运行得很好:

http://jqueryui.com/droppable/#shopping-cart

但不知何故,如果我使用Notepad++从我的计算机上运行它,它会给我一个“引用错误:$ is not defined”。

我发现了很多关于这个话题的讨论,以及很多有用和精彩的链接,例如:

http://jquery-howto.blogspot.ca/2013/02/referenceerror-jquery-is-not-defined.html

http://ryanrahlf.com/knockout-js-why-we-use-self-or-how-to-fix-referenceerror-xyz-is-not-defined/

但对我来说,这仍然是一个难题。

我将非常感谢您的反馈。

谢谢你,拉斯

EN

回答 1

Stack Overflow用户

发布于 2015-04-24 00:26:55

要从本地计算机运行此示例,您需要替换以下4个标记:

代码语言:javascript
复制
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script
<link rel="stylesheet" href="/resources/demos/style.css">

在href中使用完整urls (使用http架构):

代码语言:javascript
复制
<link rel="stylesheet" href="http://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
<script src="http://code.jquery.com/jquery-1.10.2.js"></script>
<script src="http://code.jquery.com/ui/1.11.4/jquery-ui.js"></script
<link rel="stylesheet" href="http://jqueryui.com/droppable/resources/demos/style.css">

否则,它将尝试包含本地文件系统中的jquery,即使用file::schema

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/29829104

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档