# Related to quote project

**URL:** <https://forum.freecodecamp.org/t/related-to-quote-project/104840>\
**Category:** General\
**Created:** [April 10, 2017, 9:05pm UTC](https://forum.freecodecamp.org/t/related-to-quote-project/104840 "2017-04-10T21:05:06Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![ahmedaltour](https://avatars.discourse-cdn.com/v4/letter/a/dfb087/32.png) [@ahmedaltour](https://forum.freecodecamp.org/u/ahmedaltour)\
**Post date:** [April 10, 2017, 9:05pm UTC](https://forum.freecodecamp.org/t/related-to-quote-project/104840/1 "2017-04-10T21:05:06Z")

</div>

Dear friends,

In this project I want to change background color to a random color with animated change whenever I click the button however my code doesn’t respond correctly when I click the button

HTML code

 new quote
 The message will go here 

JavaScript code

function randColor()  
{  
return “RGB(”+Math.floor(Math.random()\*255)+","+Math.floor(Math.random()\*255)+","+Math.floor(Math.random()\*255)+")";  
}

$(document).ready(function(){  
$(“body”).css(“background-color”,randColor);  
$( “#getMessage” ).click(function() {  
$(“body”).animate({  
backgroundColor: “rgb( 20, 20, 20 )”  
});  
});  
});

---

<div class="post-metadata">

**Author:** ![jx2bandito](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/jx2bandito/32/64533_2.png) [@jx2bandito](https://forum.freecodecamp.org/u/jx2bandito)\
**Post date:** [April 10, 2017, 9:09pm UTC](https://forum.freecodecamp.org/t/related-to-quote-project/104840/2 "2017-04-10T21:09:13Z")

</div>

Do you have jQuery UI included?

From [.animate() | jQuery API Documentation](http://api.jquery.com/animate/)

> Note: The jQuery UI project extends the .animate() method by allowing some non-numeric styles such as colors to be animated. The project also includes mechanisms for specifying animations through CSS classes rather than individual attributes.

---

<div class="post-metadata">

**Author:** ![ahmedaltour](https://avatars.discourse-cdn.com/v4/letter/a/dfb087/32.png) [@ahmedaltour](https://forum.freecodecamp.org/u/ahmedaltour)\
**Post date:** [April 10, 2017, 9:13pm UTC](https://forum.freecodecamp.org/t/related-to-quote-project/104840/3 "2017-04-10T21:13:02Z")

</div>

hello @jx2bandito

Yes I have JQuery UI added however it is still not responding

---

<div class="post-metadata">

**Author:** ![jx2bandito](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/jx2bandito/32/64533_2.png) [@jx2bandito](https://forum.freecodecamp.org/u/jx2bandito)\
**Post date:** [April 10, 2017, 9:13pm UTC](https://forum.freecodecamp.org/t/related-to-quote-project/104840/4 "2017-04-10T21:13:45Z")

</div>

“RGB(”+Math.floor(**Math.random()255**)+","+**Math.floor(Math.random()255**)+","+Math.floor(Math.random()\*255)+")";

You’re missing asterisks between Math.random() and 255

---

<div class="post-metadata">

**Author:** ![ahmedaltour](https://avatars.discourse-cdn.com/v4/letter/a/dfb087/32.png) [@ahmedaltour](https://forum.freecodecamp.org/u/ahmedaltour)\
**Post date:** [April 10, 2017, 9:24pm UTC](https://forum.freecodecamp.org/t/related-to-quote-project/104840/5 "2017-04-10T21:24:22Z")

</div>

hello friend

It is not showed correctly on the forum however it is correct in the code and generating the color successfully

the main issue is here

$( “#getMessage” ).click(function() {  
$(“body”).animate({  
backgroundColor: “rgb( 20, 20, 20 )”  
});

it is not conducting the animate action

---

<div class="post-metadata">

**Author:** ![jx2bandito](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/jx2bandito/32/64533_2.png) [@jx2bandito](https://forum.freecodecamp.org/u/jx2bandito)\
**Post date:** [April 10, 2017, 9:31pm UTC](https://forum.freecodecamp.org/t/related-to-quote-project/104840/6 "2017-04-10T21:31:22Z")

</div>

I plugged it into a pen and it works perfectly so it’s definitely not the code.

> **[oZKryZ](https://codepen.io/jx2bandito/pen/oZKryZ)**
>
> ...

Maybe it’s something in your HTML?

---

<div class="post-metadata">

**Author:** ![ahmedaltour](https://avatars.discourse-cdn.com/v4/letter/a/dfb087/32.png) [@ahmedaltour](https://forum.freecodecamp.org/u/ahmedaltour)\
**Post date:** [April 10, 2017, 11:39pm UTC](https://forum.freecodecamp.org/t/related-to-quote-project/104840/7 "2017-04-10T23:39:58Z")

</div>

Thanks so much @jx2bandito that was really helpful

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [January 17, 2021, 8:53pm UTC](https://forum.freecodecamp.org/t/related-to-quote-project/104840/8 "2021-01-17T20:53:39Z")

</div>

Closed on January 17, 2021, 8:53pm UTC


