- Get link
- X
- Other Apps
Use below HTML code to Check all radio buttons
<input type="radio" class="presnt_all" name="emp_attendance" id="emp_attendance" value="1"/>All Present
<input type="radio" class="absent_all" name="emp_attendance" id="emp_attendance" value="2"/>All Absent
<input type="radio" class="leave_all" name="emp_attendance" id="emp_attendance" value="3"/>All Leave
<input type="radio" class="presnt_att" name="emp_attendance1" id="emp_attendance1" value="1" />Present
<input type="radio" class="absent_att" name="emp_attendance1" id="emp_attendance1" value="2" />Absent
<input type="radio" class="leave_att" name="emp_attendance1" id="emp_attendance1" value="3" />Leave
<input type="radio" class="presnt_att" name="emp_attendance2" id="emp_attendance2" value="1" />Present
<input type="radio" class="absent_att" name="emp_attendance2" id="emp_attendance2" value="2" />Absent
<input type="radio" class="leave_att" name="emp_attendance2" id="emp_attendance2" value="3" />Leave
<input type="radio" class="presnt_att" name="emp_attendance3" id="emp_attendance3" value="1" />Present
<input type="radio" class="absent_att" name="emp_attendance3" id="emp_attendance3" value="2" />Absent
<input type="radio" class="leave_att" name="emp_attendance3" id="emp_attendance3" value="3" />Leave
<input type="radio" class="presnt_att" name="emp_attendance4" id="emp_attendance4" value="1" />Present
<input type="radio" class="absent_att" name="emp_attendance4" id="emp_attendance4" value="2" />Absent
<input type="radio" class="leave_att" name="emp_attendance4" id="emp_attendance4" value="3" />Leave
<input type="radio" class="presnt_att" name="emp_attendance5" id="emp_attendance5" value="1" />Present
<input type="radio" class="absent_att" name="emp_attendance5" id="emp_attendance5" value="2" />Absent
<input type="radio" class="leave_att" name="emp_attendance5" id="emp_attendance5" value="3" />Leave
Function:
$(document).on('click','.presnt_all,.absent_all,.leave_all', function(){
var val = $("input[name='emp_attendance']:checked").val();
if(val==1) {
cls=".presnt_att";
} else if(val==2){
cls=".absent_att";
} else if(val==3){
cls=".leave_att";
}
$(cls).prop( "checked", true );
});
Comments
Post a Comment