# How to make confetti when button is pressed (JavaScript)

**URL:** <https://forum.bubble.io/t/how-to-make-confetti-when-button-is-pressed-javascript/255217>\
**Category:** Need help\
**Created:** [April 4, 2023, 5:42pm UTC](https://forum.bubble.io/t/how-to-make-confetti-when-button-is-pressed-javascript/255217 "2023-04-04T17:42:24Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Orbit](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/orbit/32/253365_2.png) [@Orbit](https://forum.bubble.io/u/Orbit)\
**Post date:** [April 4, 2023, 5:42pm UTC](https://forum.bubble.io/t/how-to-make-confetti-when-button-is-pressed-javascript/255217/1 "2023-04-04T17:42:25Z")

</div>

I have been trying to achieve this now for a few hours and can not get it to work, even asked ChatGPT for help but no luck… anyone that can guide me in the right direction?

---

<div class="post-metadata">

**Author:** ![luke2](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/luke2/32/256674_2.png) [@luke2](https://forum.bubble.io/u/luke2)\
**Post date:** [April 4, 2023, 5:49pm UTC](https://forum.bubble.io/t/how-to-make-confetti-when-button-is-pressed-javascript/255217/2 "2023-04-04T17:49:53Z")

</div>

Are you using any specific JS and CSS to accomplish this? Are you using Toolbox?

If it’s taken more than a few hours it may be more efficient to buy a plugin that does this exact process for 5-10$. There are some decent ones.

---

<div class="post-metadata">

**Author:** ![Orbit](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/orbit/32/253365_2.png) [@Orbit](https://forum.bubble.io/u/Orbit)\
**Post date:** [April 4, 2023, 5:51pm UTC](https://forum.bubble.io/t/how-to-make-confetti-when-button-is-pressed-javascript/255217/3 "2023-04-04T17:51:48Z")

</div>

Yes im using Toolbox and no, no specific JS just trying a few! I have been looking at the plugins but i’m more doing this to learn and understand 🙂

Edit: Just got it to work… always after i make a post hahah

---

<div class="post-metadata">

**Author:** ![luke2](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/luke2/32/256674_2.png) [@luke2](https://forum.bubble.io/u/luke2)\
**Post date:** [April 4, 2023, 5:54pm UTC](https://forum.bubble.io/t/how-to-make-confetti-when-button-is-pressed-javascript/255217/4 "2023-04-04T17:54:38Z")

</div>

Good stuff. Perseverance pays off.

---

<div class="post-metadata">

**Author:** ![Orbit](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/orbit/32/253365_2.png) [@Orbit](https://forum.bubble.io/u/Orbit)\
**Post date:** [April 4, 2023, 5:58pm UTC](https://forum.bubble.io/t/how-to-make-confetti-when-button-is-pressed-javascript/255217/5 "2023-04-04T17:58:20Z")

</div>

Solution:

Create a HTML block on the page and paste the following:  
`<script src="https://cdn.jsdelivr.net/npm/tsparticles-confetti@2.9.3/tsparticles.confetti.bundle.min.js"></script>`

Create a JavaScript Workflow when the button is clicked:  
confetti({  
particleCount: 100,  
spread: 70,  
origin: { y: 0.6 },  
});

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/bubble/original/3X/2/8/2847faa74692c2ffa5d939d3dc3724cdd060d247.png) [@system](https://forum.bubble.io/u/system)\
**Post date:** [June 13, 2023, 5:42pm UTC](https://forum.bubble.io/t/how-to-make-confetti-when-button-is-pressed-javascript/255217/6 "2023-06-13T17:42:43Z")

</div>

Closed on June 13, 2023, 5:42pm UTC

This topic was automatically closed after 70 days. New replies are no longer allowed.
