Streaming live at 10am (PST)

onClick for Form Submit


Hey guys,

I have a form set up that connects to the CMS to create a div block (Zapier) upon form submit. When the user presses the native "Submit" button, I want the background color to fill the newly created div block using JS code (as is done in the codepen).

Does anyone know how to handle the onClick function of the button? I tried adding as data-attribute but it errors as reserved name.



Webflow reserves the onClick and other element attributes for security reasons.

You could delete the native submit button and introduce one using a custom embed like this;

<input type="submit" onclick="your attribute/function" value="Submit"/>

Alternatively you could add code to the footer section of your page to prevent the default submission on click and then run your function;

$('.submit-button-class').click( function() {
        //run your function here