Execute script on button click

Hi all,

Just wondering if I made a site and I wanted to execute a custom bit of script by clicking on a button how would I do that?

For example I would have a button in the middle of the screen that a user can click then the script runs (custom code).

Is it doable in Webfow?

Hello @Godweeno can you please provide an example of what you are looking to do?

I believe that you can do this, but it would only run on the published site & not in the design viewer.

Thank you,

Waldo :slight_smile:

Hey @Waldo I think we’re thinking along the same lines, I had it running for a while in the manner you are explaining but I got rid of it for another solution. I was just hoping to use a Webflow placed button so it would work on an unpublished site for testing (and easier styling of the button).

Here is an example:

Sorry I totally forgot to say click the ‘BOOK NOW’ button to see it working :stuck_out_tongue_winking_eye:

Hey @godweeno just add in a div or link block and give it your button class, then style it to your hearts desire so you know what it’ll look like when you use it in custom code. :slight_smile: You could implement a modal?

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.