我正在测试一个 html 网页,但在浏览器中它无法正常工作。无法加载:
src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"
这是错误:
GET file://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);
}
});
最佳答案
而不是
src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"
使用
src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"
关于javascript - net::ERR_FILE_NOT_FOUND:在 PhpStorm 服务器上工作但在浏览器中不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55517470/