Advertisement
PatchRowcester

javascript function that will get html form selection

May 6th, 2019
1,983
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function getFormData()
  2. {
  3.     var choice = document.getElementsByName("question");
  4.  
  5.     for (var i = 0; i < choice.length; i++)
  6.     {
  7.         if (choice[i].checked)
  8.         {
  9.             console.log("choice is: " + choice[i].value);
  10.             console.log("type: " + typeof(choice[i].value));
  11.         }
  12.     }
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement