无法从本地文件夹运行Jquery [英] Unable to run Jquery from local folder

查看:145
本文介绍了无法从本地文件夹运行Jquery的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我是网络开发新手。我需要使用 JQuery 。即使我已经成功地尝试了一个jquery ,但只有在将文件复制到我的在线ftp文件夹后。我完全无法从我的本地文件夹运行它。请解释一下,我可以在没有的情况下测试一些新脚本,并将其将文件复制到ftp文件夹。感谢您!

Hi I am new to web development. I need to work with JQuery. Even I have tried one jquery successfully but only after copying file to my online ftp folder. I am totally failed to run it from my local folder. Please explain it, how can I test some new scripts without having an additional excercise of copying file to ftp folder. Thanks in advance!

我使用的脚本(感染只是从 www.w3schools.com
此脚本仅从ftp文件夹运行,我无法从本地文件夹运行。您可以看到没有任何本地或固定的路径应该可以从一个地方得到,但不能从另一个地方得到。脚本如下:

The Script I used (infect just copied from www.w3schools.com still this script only runs from ftp folder and I am unable to run it from my local folder. You can see there is not any local or fixed path that should be available from one place but not from another. The script is as:

<!DOCTYPE html>
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script>
$(document).ready(function(){
  $("button").click(function(){
    $("p").hide();
  });
});
</script>
</head>

<body>
<h2>This is a heading</h2>
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
<button>Click me</button>
</body>
</html>

现在无法从硬盘上的文件夹运行此代码吗?

Now is not it possible to run this code from a folder on my on hard drive?

推荐答案

包含在您的头标记中:

Include in your head tag:

<!-- jQuery -->
<script src="http://code.jquery.com/jquery-latest.min.js"></script>

赞:

Like:

<head>
  <!-- jQuery -->
  <script src="http://code.jquery.com/jquery-latest.min.js"></script>
</head>

这篇关于无法从本地文件夹运行Jquery的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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