I am trying to do things when a slider is unchecked and checked.
I have a lot of these questions on stack but none of them seem to work for me this is what I have tried already:
$(function() {
$('.slider').on('click', (event) => {
console.log(event);
$("#checkout-ms").css("border-color", "#bf0d33");
$("#checkout-ms").prop('disabled', false);
});
});
this works well when I check the slider but doesnt do anything when I uncheck the slider. I have tried this as well:
$(function() {
$('.slider').on('change', function(e) {
if($(this).is(':checked')) {
$("#checkout-ms").css("border-color", "#bf0d33");
$("#checkout-ms").prop('disabled', false);
} else {
$("#checkout-ms").css("border-color", "#605e5e");
$("#checkout-ms").prop('disabled', true);
}
});
});
here is the html for the slider:
<label class="switch">
<input type="checkbox">
<span class="slider"></span>
</label>
I want something to happen when I check the slider and something to happen when I uncheck the slider.
Any Help is appreciated. Thank You <3!