I found the solution to reset radiobuttons.
This next example works well for 4 radiogroups:
<script type="text/javascript">
function uncheckRadio()
{
for(x=0; x<document.QuizForm.Q01.length; x++){document.QuizForm.Q01[x].checked = false;}
for(x=0; x<document.QuizForm.Q02.length; x++){document.QuizForm.Q02[x].checked = false;}
for(x=0; x<document.QuizForm.Q03.length; x++){document.QuizForm.Q03[x].checked = false;}
for(x=0; x<document.QuizForm.Q04.length; x++){document.QuizForm.Q04[x].checked = false;}
}
</script>
But now I want to reset 80 radiogroups in one single (multiple choice) form by applying a nested loop to iterate from 01 to 80.
Tried several ways to use nested loops, but somehow I cannot find a way to get the Q01, Q02 etc. iteration to work…
Many thanks
In the browser that supports the standards, you could use querySelectorAll, if you’re sure that there are no other radio with
nameattributes that starts with “Q”:Otherwise you can use the square bracket notation: