Is there a reason why I don't see an alert when the checkbox is checked in my code?
jQuery(function($) {
if ($('input#choice_3_37_1').is(':checked')) {
alert('test');
$("#label_3_37_1").addClass("gquiz-correct-choice");
}
});
.gquiz-correct-choice {
background: green;
color: white
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<input type="checkbox" id="choice_3_37_1" name="change">
<hr>
<label id="label_3_37_1">this should change to green!</label>