I am trying to disable a button when a checkbox is not checked and enable it again when it's checked.
So to test I added a console log inside the code, but there is no message in my console when I check the checkbox.
My code:
the_terms.click(function() {
console.log('test');
if (jQuery(this).is(":checked")) {
jQuery("#checkoutbtn").removeAttr("disabled");
} else {
jQuery("#checkoutbtn").attr("disabled", "disabled");
}
});
Then the button and checkbox:
<button type="submit" title="<?php echo $this->__('Place Order') ?>" class="button btn-checkout" id="checkoutbtn" onclick="review.save();" disabled="disabled"><span><?php echo $this->__('Place Order') ?></span></button>
<p><input type="checkbox" class="checkbox" id="voorwaarden" style="display:inline;"/><b> Ik ga akkoord met de algemene voorwaarden</b></p>
What's wrong?
Aucun commentaire:
Enregistrer un commentaire