I am generating multiple buttons using PHP:
<form name="submit_form" id="submit_form" action="">
<?php
for ($i = 0; $i < count($value); $i++) {?>
<input type="radio" name="answer" value="<?php echo $value[$i]; ?>"/>$value[$i]<?php }?>
</form>
I have problem checking if radio button is selected using Javascript since it keeps returning 'undefined'
I am accessing radio buttons (before ) using javascript in this way:
alert(document.forms["submit_form"].elements["answer"].checked);
I have tried echoing whole html, same thing happens...