Can I execute a button's OnClick function via wix code instead of when a user clicks the button?


I’m using a button to perform a series of calculations when it is clicked by the user. I need for this same function to be executed separately via wix code in addition to when the user clicks the button. Is there a way to do this? It would require me to call the function below inside of another function in the wix code…

export function buttonSubmit_click(event, $w)


Hey there Hypno,

Just spin off your submit code to a separate function. You can then call that function from the onClick() handler or from somewhere else in your code. Something like this:

export function buttonSubmit_click(event, $w) {

function submit() {
   // all sorts of mean nasty code

// from somewhere in your code...

Depending on what your code does, you might have to deal with sending the proper parameters to the function, but that’s just a piece of cake. Right?

I hope this helps,


I want to call a google adwords function gtag_report_conversion on click of WIX form submit button. I have embedded the code snippet provided by the adwords in all HTMLforms

Hello Neelam Jain,

please open your own post with your own topic.
Do not bump-up over 2-years old posts.

And describe a little bite more your issue.

  • your code?

  • some pics?

  • some facts?

Then the community can help much faster, better and more efficient.