I am trying to disable other options immediately once an option is selected but using java-script I could not do this. Please help me. I have tried so far
<?php
$answer = $exm->getAnswer($number);
if ($answer) {
while ($result = $answer->fetch_assoc()) {
?>
<tr>
<td>
<input id="question_radio" type="radio" name="ans" value="<?php echo $result['id']; ?>"/><?php echo $result['ans']; ?>
<script id="question_radio" type="text/javascript">$(":radio").click(function(){
var radioName = $(this).attr("ans"); //Get radio name
$(":radio[name='"+radioName+"']:not(:checked)").attr("disabled", true); //Disable all unchecked radios with the same name
});
</script>
</td>
</tr>
<?php } } ?>
<tr>
<td>
<input type="submit" name="submit" value="Next Question"/>
<input type="hidden" name="number" value="<?php echo $number; ?>" />
</td>
</tr>