# Random quote machine - Bug when switching quote

**URL:** <https://forum.freecodecamp.org/t/random-quote-machine-bug-when-switching-quote/178313>\
**Category:** General\
**Created:** [March 6, 2018, 8:39pm UTC](https://forum.freecodecamp.org/t/random-quote-machine-bug-when-switching-quote/178313 "2018-03-06T20:39:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![HackinoSelov](https://avatars.discourse-cdn.com/v4/letter/h/ecc23a/32.png) [@HackinoSelov](https://forum.freecodecamp.org/u/HackinoSelov)\
**Post date:** [March 6, 2018, 8:39pm UTC](https://forum.freecodecamp.org/t/random-quote-machine-bug-when-switching-quote/178313/1 "2018-03-06T20:39:24Z")

</div>

Hi all,

I’m currently trying to build a Random quote machine.

I’m building it step-by-step and I just wrote the basic JS code to change the quote on click.

However, it seems the JS code has a bug.

Indeed, everytime I click on the “refresh” icon :

- there is a white screen for 1sec and;
- it seems that the quote changes twice (once on click and once automatically…)

I don’t understand why…

Any help ?

> **[PQrqJY](https://codepen.io/HackinoSelov/full/PQrqJY/)**
>
> ...

Thank you 🙂

---

<div class="post-metadata">

**Author:** ![HackinoSelov](https://avatars.discourse-cdn.com/v4/letter/h/ecc23a/32.png) [@HackinoSelov](https://forum.freecodecamp.org/u/HackinoSelov)\
**Post date:** [March 7, 2018, 7:48am UTC](https://forum.freecodecamp.org/t/random-quote-machine-bug-when-switching-quote/178313/3 "2018-03-07T07:48:17Z")

</div>

Nice!

Thank you very much for your help Randell!

Now I just have to make the icon looks like a link with css (use the pointer cursor).

Thanks once again 🙂

---

<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:25pm UTC](https://forum.freecodecamp.org/t/random-quote-machine-bug-when-switching-quote/178313/4 "2021-01-17T20:25:05Z")

</div>

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


