How to run Javascript from an action in Bubble

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

Share:

More Posts

What is a Data Concept?

The Data Concept is a framework on how to think about the data in your app in order to set up an efficient database structure.

Satellite Data Types in Bubble

In our last Bubble.io article, we looked at how we can use the Data Weight analogy to visualize how the structure of our Data Types can affect performance. But what do we do with the information? What is a Satellite

What is Data Weight?

Data Weight is a way to think about your database structure when you build for performance.

Leave A Reply

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

*