【发布时间】:2019-08-26 07:11:45
【问题描述】:
我正在测试一个 html 网页,但在浏览器中它无法正常工作。它无法加载:
src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"
这是错误:
获取文件://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js net::ERR_FILE_NOT_FOUND
我想质疑同一个 html 网页中的另一个错误,如下所示:
Uncaught ReferenceError: $ is not defined at files.html:337
这是脚本:
$('.toggle').click(function (e) {
e.preventDefault();
var $this = $(this);
if ($this.next().hasClass('show')) {
$this.next().removeClass('show');
$this.next().slideUp(350);
} else {
$this.parent().parent().find('li .inner').removeClass('show');
$this.parent().parent().find('li .inner').slideUp(350);
$this.next().toggleClass('show');
$this.next().slideToggle(350);
}
});
【问题讨论】:
-
你是怎么打开那个页面的?什么网址?请注意错误的
file://- 看起来您已经通过file://打开它.. 所以我认为错误是意料之中的,如果您想以这种方式打开它,您需要使用完整的url (https://cdn...)。
标签: javascript html phpstorm