开发者

jQuery - The background is still not changing [duplicate]

This question already has answers here: Closed 11 years ago.

Possible Duplicate:

jQuery - Background color not changing

I know I have posted the similar question several times, but it is really confusing me why not working.

This is my latest version of the code:

HTML

<html>
<head>
<script type="text/javascript" src="jquery-1.6.4.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8.16.custom.min.js"></script>
<sc开发者_开发知识库ript type="text/javascript" src="script.js"></script>
<style type="text/css"> 
#name{
background-color: #FFFFF2;
width: 100px;
}
</style>
</head>
<body>
<input type="button" id="bgcolor" value="Change color"/>
<div id="name">
Abder-Rahman
</div>
</body>
</html>

script.js

$("#bgcolor").click(function(){
    $("#name").animate(
        {backgroundColor: '#8B008B'},
        "fast");}
);

I want to notice that I have a folder called: jquery-ui-1.8.16.custom, and this is where I'm putting these files in. And, I have referenced jquery-1.6.4,js as shown above which I also have it in the same folder, in addition to referencing jquery-ui-1.8.16.custom.min.js which is in the js folder in the current folder.

What am I getting wrong here? Isn't this the way to reference jQuery and jQueryUI?

EDIT

Browser used: Mozilla Firefox 6.0.2

Folder structure: jquery-ui-1.8.16.custom/abc.html jquery-ui-1.8.16.custom/script.js jquery-ui-1.8.16.custom/jquery-1.6.4.js jquery-ui-1.8.16.custom/js/jquery-ui-1.8.16.custom.min.js

Thanks.


Did you put it in the window or document onload function? Is this page in the same folder as your scripts?

$(document).ready(function(){
    $("#bgcolor").click(function(){
    $("#name").animate(
        {backgroundColor: '#8B008B'},
        "fast");}
);
});


You probably somehow fail to include jQueryUI as that is where colour animation comes from. Is your jquery-ui-1.8.16.custom.min.js inside of a folder called js? You should also include your folder structure into this question as it's unclear what's wrong otherwise. Also you might want to look into the developer console of your browser if there is such a thing there (it might tell you of files failed to load or syntax errors you have). You also should mention what browser you're on to make it easier to help you.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜