Skip to main content
Jhon Carlo
Inspiring
January 12, 2019
Question

Set "onClick" like a variable

  • January 12, 2019
  • 1 reply
  • 436 views

I need to set "onClick" like a variable, something like this:

<script>

var = MyVar;

MyVar = x;

function MyFunction + MyVar (){

MyCode;

}

</script>

<button type="button"  onClick="MyFunction + MyVar()"> </button>

Is there a way to set this?

Thanks;

This topic has been closed for replies.

1 reply

BenPleysier
Community Expert
January 12, 2019
Wappler is the DMXzone-made Dreamweaver replacement and includes the best of their powerful extensions, as well as much more!
Jhon Carlo
Inspiring
January 12, 2019

Thank you Ben!

If I'm right in "Tryit Editor" I get the value from the onClick, what I need is the opposite:

assign a var to "onClick"

Thank you again.