I have two chech Boxes (one of them disabled). I have replaced the check boxes with a div with background color with toggle function so that checked = green, unchecked = red.
HTML
<input type="checkbox" class="input_class_checkbox" disabled="disabled">
<br/>
<input type="checkbox" class="input_class_checkbox">
JQUERY
$('.input_class_checkbox').each(function(){
$(this).hide().after('<div class="class_checkbox" />');
});
$('.class_checkbox').on('click',function(){
$(this).toggleClass('checked').prev().prop('checked',$(this).is('.checked'))
});
CSS
.class_checkbox {
width: 20px;
height: 20px;
background-color: red;
}
.class_checkbox.checked {
background-color: green;
}
.class_checkbox.disabled {
background-color: blue;
}
How do I apply this .disabled CSS on the disabled check box on page load? also check boxes can be disabled programmatically, so can I implement onDisabled kind of Jquery code to change the appearance when a check box is disabled?