As per the image I want to check and uncheck radio button as all present and all absent. I have written some code but it works only once.
$(document).on('click', '#btn_all_absent', function(e){
$("input:radio[class^=present]").each(function(i) {
$(this).attr('checked',false);
});
$("input:radio[class^=absent]").each(function(i) {
$(this).attr('checked',true);
});
});
$(document).on('click', '#btn_all_present', function(e){
$("input:radio[class^=absent]").each(function(i) {
$(this).attr('checked',false);
});
$("input:radio[class^=present]").each(function(i) {
$(this).attr('checked',true);
});
});
Please suggest me where I am wrong.