Skip to content
Advertisement

Store multiple radio button values in an array Javascript

I would like to store my test answers in an array in javascript. I created 50 questions with for loop, the user can choose between 4 radio buttons(answer). How could i store these answers in an array?

MY QUESTION CARDS

JavaScript

WHAT I TRIED:

JavaScript

Advertisement

Answer

Just use loop over an array containing the names of the radio button groups and get the value of the selected button in that group and add to the array:

JavaScript
JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement