我不明白为什么我会得到这个,下面的代码:未捕获的ReferenceError:jQuery是没有定义
<head>
<script src="https://code.jquery.com/color/jquery.color-2.1.2.min.js" type="text/javascript"></script>
<script>
var json1 = {
text: "After first paragraph"
};
var first_content_added = false;
$(function() {
$(".learn-more").on("click", function() {
$.getJSON("json_info.json", function(data) {
appendContentToFirstP(data.reviews[0].about.moreinfo);
});
});
});
function appendContentToFirstP(content) {
if (first_content_added) {
return;
}
var after_first_p = $('<p class="more-info" />');
after_first_p.text(content);
$(".first").append(after_first_p);
first_content_added = true;
}
</script>
</head>
什么会导致错误? 我最初的想法是错误是因为我没有导入JQuery,但我有。它位于顶部的脚本标签内。
你不是已经包括JQuery的本身,而是另一个librarie jquery.color – 2014-12-03 13:04:12