I would like to know if there is any way to implement an alternate call in the onclick
function, so when I click it once it executes a function, and when I click again call another function ...
An example would be using checkbox
. When I click the first time it displays a message "You selected this option" and does a calculation of addition, so if I click again it will appear a message "You have deselected this option", and do a subtraction calculation ...
The checkbox generally does not work like this, but could also be for example a simple power button on and off.
Lastly, I wonder if it is possible to perform this switch using onclick
and how it would be.
Thank you.