-
-
Save MkDierz/f02a150b14a20e87970354d4f254536a to your computer and use it in GitHub Desktop.
Randomly select all radio buttons on a form
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var a = document.querySelectorAll('input[type=radio]'); | |
for (var i=0; i<a.length; i++) | |
// from https://stackoverflow.com/a/18066088/8148848 | |
a[i].checked = ( (Math.random()*10) > 5) ? true : false; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment