I have a button which by default is disable, but when a checkbox is checked the button is then enabled. I would like to edit the script to make an alert window when the button is clicked when disabled, to make sure the user knows he/she has to check the checkbox.
My script so far:
<script type="text/javascript">
$('#terms').on('change', function(){
if ($(this).is(':checked')){
$('#customButton').removeProp('disabled');
}
else{
$('#customButton').attr('disabled', 'disabled');
}
});
</script>
<form id="payment-form" action="chargeCard.php" method="POST" name="payment-form">
<input type="checkbox" id="terms" />
<input type="image" src="button3.png" id="customButton" value="submit" alt="button" disabled="disabled"/>
</form>
Aucun commentaire:
Enregistrer un commentaire