JSFiddle - React, Tailwind, and code Playground
by dying_sakura
HTML
<form id="payment-form" action="chargeCard.php" method="POST" name="payment-form">
<input type="checkbox" id="terms" />
<input type="button" id="customButton" value="submit" alt="button" class="disabled"/>
</form>
JavaScript
$('#terms').on('change', function(){
if ($(this).is(':checked')){
$('#customButton').removeClass('disabled');
}
else{
$('#customButton').addClass('disabled');
}
});
$('#customButton').on('click',function(e){
if( $(this).hasClass('disabled') ){
e.preventDefault();
alert('Please confirm . . .');
}else{
alert('go ahead...');
};
});