Toggle Onclick value if checkbox is checked

Toggle Onclick value if checkbox is checked

Hello,

I have a form that uses multiple actions, and what I'm trying to do is toggle the onclick value.

  1. <form>
    <input type="text" name="email" id="email" value="Email" class="text-input" />
    <input name="" type="checkbox" value="Yes" />
    <input type="submit" value="Button1" name="subscribe" id="subscribe" class="button" onclick="OnButton1(); OnButton2();">
    </form>



basically, what I want to happen is, if user check the checkbox, OnButton1(); will be added and if not, OnButton1(); will be removed..

It's just a dummy Form code, I just need to know how to achieve what I need with the "onclick".

Thank you so much..