Get radio button input value


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. /**
  2.  * Example. return radioValue(form['radioName'])
  3.  */
  4. function radioValue(radioNodeList) {
  5. for (var i = radioNodeList.length - 1; i > -1; i--) {
  6. if (radioNodeList[i].checked) {
  7. return radioNodeList[i].value;
  8. }
  9. }
  10. return false;
  11. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.