$或jQuery未定义

yea*_* me 4 javascript jquery

<script href="http://code.jquery.com/jquery-1.10.2.min.js"></script>

<script>
    console.log($);
    console.log(jQuery);
</script>
Run Code Online (Sandbox Code Playgroud)

我收到的消息是$jQuery未定义:出了什么问题?

它只是一个空的index.html,没有其他代码.

War*_*0ck 25

您使用该href属性将脚本包含在文件中.

href<script></script>标记的无效属性.使用src,而不是...

<script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
Run Code Online (Sandbox Code Playgroud)


小智 5

您的声明中有错误.你应该用

<script src="...">
Run Code Online (Sandbox Code Playgroud)

代替

<script href="">.
Run Code Online (Sandbox Code Playgroud)