Javascript ReferenceError 找不到变量:$
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4888725/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
ReferenceError can't find variable: $
提问by none
Possible Duplicate:
ReferenceError: Can't find variable: $
I get this error:
我收到此错误:
ReferenceError: Can't find variable:
$
参考错误:找不到变量:
$
Any ideas?
有任何想法吗?
采纳答案by RvdK
Is the jquery javascript file loaded before you call anything with it -> using the selector $? Please check with Chrome or Firefox+firebug if the jquery library is loaded correctly. Maybe the path could be not correct
jquery javascript 文件是否在您调用任何内容之前加载 -> 使用选择器 $?请检查 Chrome 或 Firefox+firebug 是否正确加载了 jquery 库。也许路径可能不正确
After that, try to place your code into:
之后,尝试将您的代码放入:
$(document).ready(function() {
// put all your jQuery goodness in here.
});
This will make sure that '// put all your jQuery goodness in here.' will be executed after jQuery has been loaded.
这将确保“// 将您所有的 jQuery 优点放在此处。” 将在 jQuery 加载后执行。
回答by bobgubko
wrong url in <script>
for jQuery ?
<script>
jQuery 中的url 错误?