jQuery拒绝工作

jQuery拒绝工作,jquery,Jquery,我已经试着让一个简单的jQuery示例运行了几个小时 <!DOCTYPE html> <html> <head> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"> </script> <script> $(document).ready(function(){ $("button").click(function(){

我已经试着让一个简单的jQuery示例运行了几个小时

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

<button>Toggle</button>
<p>This is a paragraph with little content.</p>
<p>This is another small paragraph.</p>
</body>
</html>

$(文档).ready(函数(){
$(“按钮”)。单击(函数(){
$(“p”).toggle();
});
});
切换
这是一段内容很少的段落

这是另一小段


我似乎无法加载jQuery。

可能您正在本地运行html

尝试在jquery url中使用
http:
,如下所示-

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js">

您的脚本url上似乎缺少http:前缀:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js">

put
http:
包含javascript时:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js">

更新这行代码

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js">



为src添加了
https:

最佳猜测:您的计算机上没有安装web服务器,并且您正在从本地文件系统加载页面,因此jQuery地址中的
/
会选择
文件:/
协议。这将是一个很好的时间来学习浏览器的错误控制台是如何工作的,这样你就可以自己调试类似的东西了。你能在ajax.googleapis.com前面删除//然后try@Satya这当然行不通。@user1925923你指的是谁是神,朱哈那还是神:D
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js">