JavaScript未捕获ReferenceError:未定义jQuery;未定义jQuery.未捕获的ReferenceError:未定义$ [英] JavaScript Uncaught ReferenceError: jQuery is not defined; Uncaught ReferenceError: $ is not defined
问题描述
这是我的提琴, http://jsfiddle.net/4vaxE/35/
在我的小提琴中效果很好.
It work fine in my fiddle.
但是,当我将其转移到Dreamweaver时,它将无法工作.而且我在编码中发现了这两个错误.
However, when I transfer it to dreamweaver, it can't work. And I found this two error in my coding.
- 未捕获的ReferenceError:未定义jQuery
- 未定义的referenceerror $未定义
在阅读与这两个错误相关的文章之前,我已经尝试过,并尝试根据提供的方法进行解决,但是仍然无法正常工作,我该如何解决呢?
I had read before the article related to this two error, and tried to solve according to the method provided, however, it still not working, how can I solve this?
这是我在Dreamweaver中的完整编码
Here is my full coding in 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库:
Cause you need to add jQuery library to your file:
jQuery UI只是jQuery的一个插件,这意味着
首先,您需要包含 jQuery 库→然后是 UI .
jQuery UI is just an addon to jQuery which means that
first you need to include the jQuery library → and then the UI.
<script src="path/to/your/jquery.min.js"></script>
<script src="path/to/your/jquery.ui.min.js"></script>
这篇关于JavaScript未捕获ReferenceError:未定义jQuery;未定义jQuery.未捕获的ReferenceError:未定义$的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!