Onclick Disable Button
Tue Oct 10 2023 23:39:23 GMT+0000 (Coordinated Universal Time)
Saved by
@hamzakhan123
<div class="text-center">
<input class="btn btn-2 submitBtn" type="submit" id="quoteSubmit" name="quote" value="Submit Request" disabled="disabled">
</div>
<div class="col-md-12 mb-3">
<div class="form-group" style="margin-left: 25px;">
<input type="checkbox" class="form-check-input" id="click" required="required">
<label class="form-check-label" for="click">by clicking the submit button below you will be giving permission to contact via SMS regarding your digital services</label>
</div>
</div>
$(document).ready(function() {
// Attach a change event listener to the checkbox
$(document).on('change', "#click", function(e) {
console.log('clicked');
// Check if the checkbox is checked
if ($(this).is(':checked')) {
// If checked, enable the submit button
$('.submitform').removeAttr('disabled');
console.log('disabled');
} else {
// If not checked, disable the submit button
$('.submitform').attr('disabled', 'disabled');
console.log('enabled');
}
});
});
content_copyCOPY
Comments