Possible to use custom JS to set a state on page?

Is it possible to use custom JS to set a state on a page that is recognized by a condition in Bubble?

For example, I want to hide an element on a page until some custom JS runs. Once done, I’d like this custom JS to unhide the element.

I have a condition on an element.

With custom JS can I do something like…so which will trigger the condition?
var showBackgroundImage = “yes”;

Yes. Here’s how:

  • Have your javascript set a variable’s value
  • Use the Javascript to Bubble feature (in toolbox, I believe) to get that value into Bubble
  • Then, set a workflow to run when the Javascript to Bubble’s value is, say, yes… and have an action within that workflow set a custom state.
2 Likes

thanks.

1 Like