fbpx

How to run Javascript from an action in Bubble

Follow me:

Even though Bubble itself is mostly built on Javascript, there’s no way to run a script from a workflow action. Luckily, it’s easy to get around it by using the brilliant Toolbox plugin.

Install the plugin

The Toolbox plugin in the Bubble plugin store

The first thing we need to do is to locate the Toolbox plugin in the Bubble plugin store. This plugin has been around for years, and offers numerous extremely useful elements and actions.

Draw a button on the page

The Start/Edit workflow button in Bubble

We’ll need something to trigger the Javascript action. For this we can use a simple button. Click on the button to see its properties, and then Click the Start/Edit workflow button in the element inspector.

Create the Run Javascript action

Menu showing how to run Javascript from an action in Bubble

You’ll be taken into the Bubble workflow editor. Add an action in the button-click workflow, and search for Run Javascript or navigate to the Plugins submenu.

Enter the Javascript to run in the Action step

Adding Javascript to a workflow step in Bubble

You can write or paste the Javascript directly into the action step itself, and it will trigger each time your button is clicked.

Javascript is a pretty easy programming language and can greatly extend Bubble’s features, like copying text to the clipboard. If you’re not fluent in computerese, make sure to visit the Bubble forum, where you’ll always find someone happy to help out.

Support the site and keep it free ❤️

I love tech startups and the Bubble community, and have made it my mission to try and create content that’s valuable, easy to follow and entertaining.

Creating content next to full-time consulting work is time-consuming; if you’d like to support it and keep the site free for everyone, please consider buying me a coffee or becoming a supporting member.

Buy Me A Coffee

Follow me:
Bubble.io books

Learn Bubble the right way

Our professional Bubble books teach you how to plan, structure and build your applications right from the start.

5-star review stars

More Posts

3 Comments


Chris Smith-Hill
October 16, 2022 at 17:19
Reply

Could you put some example js perhaps? I tried running a command to print to console and nothing happened.
console.log(“Hello World”)


    Petter Amlie
    October 17, 2022 at 13:11
    Reply

    Hey, thanks for the comment! In all honesty my knowledge on Javascript is very limited so I’m probably not the best person to answer this – I’d try posting this on the Bubble forum, and feel free to correct me if I’m misinforming in some way in my article!

Karan
December 31, 2022 at 12:52
Reply

i have a button inside repeating group and i am running javascript code in workflow using run javascript. but somehow it does not run first time i click …it runs on the every second click of a button inside repeating group? can u guide what is the problem there?


Leave A Reply

Your email address will not be published. Required fields are marked *

*

Email icon

Useful articles and tips

Join the mailing list to get guides, opinions and articles on Bubble, no-code, automation and the tech industry.

We don't share your email address with anyone, and you can unsubscribe at any time.

You have successfully subscribed