jeudi 3 mars 2016

Using jQuery toggle to hide/show form submit button based on checkbox being checked - how to set submit button toggled off by default?

I have a form that I'm using whereby I would like to require a checkbox ('terms') to be checked in order to toggle the Submit button ('checkout-submit') on. I have it working just fine once you check the checkbox and then uncheck, etc.

But, by default the Submit button is showing. I'm unsure in my code how to ensure that the Submit button is toggled off when the page loads.

$('#terms').click(function() {
$("#checkout-submit").toggle(this.checked);
});




Aucun commentaire:

Enregistrer un commentaire