请你看一下这个link,让我知道为什么jQuery不在这里工作?
我在Cloud9 ide在线编辑器上运行该页面,这是</body>
标记之前的代码
<script src="http://codeorigin.jquery.com/jquery-1.10.2.js" type="text/javascript"></script>
<script src="js/bootstrap.js"></script>
<script>
$(document).ready(function() {
alert("This is a Test Message");
});
</script>
</body>
以下是消费者的错误清单:
未捕获TypeError:undefined不是函数bootstrap.js:29
未捕获的ReferenceError:$未定义layout.html:48
由于
答案 0 :(得分:3)
尝试更改
<script src="http://codeorigin.jquery.com/jquery-1.10.2.js" type="text/javascript"></script>
到
https://
代替http://
答案 1 :(得分:2)
如果你在浏览器中查看警告,你会看到原因。 问题是它完全拒绝加载导致$ undifined的jquery.js。
这是我得到的警告:
[已屏蔽] https://c9.io/behseini/daycare/workspace/layout.html处的页面内容来自http://codeorigin.jquery.com/jquery-1.10.2.js的不安全内容。
有了这个错误,我想你可以按照这个链接:
Warning : The page index.html ran insecure content
您的https原因,您必须在https上加载文件 尝试使用该网址:https://code.jquery.com/jquery-1.10.2.min.js
希望能帮助你。