最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - jQuery Script not loading at all - Stack Overflow

programmeradmin2浏览0评论

I am losing a ton of time trying to diagnose this issue. Any help would be fabulous. This is my first experience using cPanel and I have uploaded my files properly to the public_html. The stylesheet and html load beautifully but the js file will not. Any suggestions would be great. Here is my code

HTML

<html>
<head>
<link href="" rel="stylesheet"> 
<script src="jquery-1.12.4.min.js"></script>
</head>
<body>
...
</div>
<script type="text/javascript" src="http://example/test.js"></script>
</body>
</html>

JS

$(document).ready(function() {
  $("li.upper").hide();
  $("li.lower").hide();
.....
    console.log(newContent);
    $('#container').html(newContent);
  });
});

I am losing a ton of time trying to diagnose this issue. Any help would be fabulous. This is my first experience using cPanel and I have uploaded my files properly to the public_html. The stylesheet and html load beautifully but the js file will not. Any suggestions would be great. Here is my code

HTML

<html>
<head>
<link href="http://test.css" rel="stylesheet"> 
<script src="jquery-1.12.4.min.js"></script>
</head>
<body>
...
</div>
<script type="text/javascript" src="http://example/test.js"></script>
</body>
</html>

JS

$(document).ready(function() {
  $("li.upper").hide();
  $("li.lower").hide();
.....
    console.log(newContent);
    $('#container').html(newContent);
  });
});
Share Improve this question edited Oct 11, 2016 at 20:25 marc_s 756k184 gold badges1.4k silver badges1.5k bronze badges asked Aug 21, 2016 at 21:58 RyeGuyRyeGuy 4,50310 gold badges35 silver badges62 bronze badges 3
  • 3 You need to place your version of jquery in the public_html directory. – stevenelberger Commented Aug 21, 2016 at 22:00
  • Is there any error in console ? – w411 3 Commented Aug 21, 2016 at 22:04
  • No error in the console. I'll try placing a version of jQuery in my public directory – RyeGuy Commented Aug 21, 2016 at 22:11
Add a ment  | 

2 Answers 2

Reset to default 8

You can use CDN. To do that just include this code inside your head tag.

<script src="https://cdnjs.cloudflare./ajax/libs/jquery/2.2.4/jquery.min.js"></script>

and delete this line of code

<script src="jquery-1.12.4.min.js"></script>

other wise download jquery library from this link and paste it on the public_html directory.

That is because you are telling the browser to load "jquery-1.12.4.min.js" from your public_html directory but we can see from the screenshot of your folder that it is not there in your public_html directory.

发布评论

评论列表(0)

  1. 暂无评论