Skip to content

Instantly share code, notes, and snippets.

@ciamarro
Created July 7, 2017 13:07
Show Gist options
  • Select an option

  • Save ciamarro/2591258d697ac2a13d5148b1caa3202e to your computer and use it in GitHub Desktop.

Select an option

Save ciamarro/2591258d697ac2a13d5148b1caa3202e to your computer and use it in GitHub Desktop.

Revisions

  1. ciamarro revised this gist Jul 7, 2017. No changes.
  2. ciamarro created this gist Jul 7, 2017.
    4 changes: 4 additions & 0 deletions random_radio.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,4 @@
    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;