This question already has answers here:
Uncaught ReferenceError: $ is not defined?
(37个答案)
5年前关闭。
这是我的小提琴,http://jsfiddle.net/4vaxE/35/
在我的提琴中效果很好。
但是,当我将其转移到Dreamweaver时,它将无法工作。我在编码中发现了这两个错误。
未捕获的ReferenceError:未定义jQuery
未定义的referenceerror $未定义
在阅读与这两个错误相关的文章之前,我已经阅读过,并尝试根据提供的方法进行解决,但是仍然无法正常工作,我该如何解决呢?
这是我在Dreamweaver中的完整编码
的CSS
(37个答案)
5年前关闭。
这是我的小提琴,http://jsfiddle.net/4vaxE/35/
在我的提琴中效果很好。
但是,当我将其转移到Dreamweaver时,它将无法工作。我在编码中发现了这两个错误。
未捕获的ReferenceError:未定义jQuery
未定义的referenceerror $未定义
在阅读与这两个错误相关的文章之前,我已经阅读过,并尝试根据提供的方法进行解决,但是仍然无法正常工作,我该如何解决呢?
这是我在Dreamweaver中的完整编码
<body>
<div class="buttons" style="background-color: rgba(0,0,0,.8);">
<a class="button" id="showdiv1">Div 1</a>
<a class="button" id="showdiv2">Div 2</a>
<a class="button" id="showdiv3">Div 3</a>
<a class="button" id="showdiv4">Div 4</a>
</div>
<div id="div1">1</div>
<div id="div2">2</div>
<div id="div3">3</div>
<div id="div4">4</div>
</div>
<script language="JavaScript" type="text/javascript" script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.0/jquery-ui.min.js"></script>
<script language="JavaScript" type="text/javascript">
var selectedEffect="explode";
var options = { percent: 100 };
$('#showdiv1').click(function () {
$('div[id^=div]').hide();
$('#div1').show( selectedEffect, options, 500, callback );
});
$('#showdiv2').click(function () {
$('div[id^=div]').hide();
$('#div2').show( selectedEffect, options, 500, callback );
});
$('#showdiv3').click(function () {
$('div[id^=div]').hide();
$('#div3').show( selectedEffect, options, 500, callback );
});
$('#showdiv4').click(function () {
$('div[id^=div]').hide();
$('#div4').show( selectedEffect, options, 500, callback );
});
function callback() {
setTimeout(function() {
$( "#effect:visible" ).removeAttr( "style" ).fadeOut();
}, 1000 );
};
</script>
</body>
</html>
的CSS
<style type="text/css">
.button {
cursor:pointer;
display:inline-block;
margin:10px;
clip: rect(auto,auto,auto,auto);
}
#div1 {
background:aqua;
padding:20px;
width:100px;
text-align:center;
display:none;
}
#div2 {
background:blue;
padding:20px;
width:100px;
text-align:center;
display:none;
}
#div3 {
background:orange;
padding:20px;
width:100px;
text-align:center;
display:none;
}
#div4 {
background:green;
padding:20px;
width:100px;
text-align:center;
display:none;
}
a {
color:aqua;
-webkit-filter: grayscale(1.0);
}
a:hover {
color:red;
-webkit-filter: grayscale(0.0);
}
</style>
最佳答案
因为您需要将jQuery库添加到文件中:
jQuery UI只是jQuery的一个附加组件,这意味着
首先,您需要包括jQuery库→然后是UI。
<script src="path/to/your/jquery.min.js"></script>
<script src="path/to/your/jquery.ui.min.js"></script>
关于jquery - JavaScript未捕获ReferenceError:jQuery未定义;未被捕获的ReferenceError:未定义$ ,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/24946616/