ReferenceError无法找到变量:$ [英] ReferenceError can't find variable: $

查看:145
本文介绍了ReferenceError无法找到变量:$的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能重复:

ReferenceError:找不到变量:$

我得到这个错误:


ReferenceError:找不到变量: $

任何想法?

推荐答案

在用它调用任何东西之前加载jquery javascript文件 - >使用选择器$?
如果正确加载了jquery库,请查看Chrome或Firefox + firebug。可能路径可能不正确

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

之后,尝试将代码放入:

After that, try to place your code into:

$(document).ready(function() {
  // put all your jQuery goodness in here.
});

这将确保'//将你所有的jQuery优点放在这里。'将在执行之后执行jQuery已经加载。

This will make sure that '// put all your jQuery goodness in here.' will be executed after jQuery has been loaded.

这篇关于ReferenceError无法找到变量:$的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆