<table> <?php  if(count($members))
$j=1;
foreach($members as $key => $member)
 <tr> <td><label><?php echo $j.". "."  ".$member->member_id."  ".$member->name;?></label></td> <td><input type="radio"  id="attendance_<?php echo $key?>" name="attendance[<?php echo $key?>]" value="present" required >Present
    <input type="radio"   id="attendance_<?php echo $key?>" name="attendance[<?php echo $key?>]" value="absent" required >Absent</label></td> <td><select  name="reason" id="reason" required style="display:none"> <option value="Work">Work</option> <option value="India">India</option> <option value="Sick">Sick</option> <option value="Personal/Family Issues">Personal/Family Issues</option> <option value="Overseas">Overseas</option> <option value="No reason/No response">No reason/No response</option> </select></td> <td><input type="text"  name="remarks1" id="remarks1" placeholder="Remarks." required style="display:none"></td> </tr> <?php       $j++;       
</table>

Please, help us to help you. We are here to help, but saying "need javascript" with a blurb that's a mix of HTML and PHP, without even explaining what it does, why you posted it, what's not working, or what you're trying to do, makes it really hard for us to help you.