Streaming live at 10am (PST)

Execute javascript function when click on button?

Hello webflow world

All is in the title. I just want to execute a javascript function when user click on a button. is there a way to do so?

Thanks all!

You’d need to use a custom HTML embed (as the attribute is reserved in the Designer) but you could create your own custom button with the onclick attribute:

<button onclick="yourFunction()">Button Text</button>

Then just make sure you’ve got yourFunction() included on the project in the footer:

  function yourFunction() {
    *your function code here*