Created
October 24, 2016 09:28
-
-
Save vayn/42557261a5467acd5cf394ceb72afee3 to your computer and use it in GitHub Desktop.
Revisions
-
vayn created this gist
Oct 24, 2016 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ function getRandomInt(min, max) { return Math.floor(Math.random() * (max - min + 1)) + min; } var radios = Array.prototype.slice.call(document.querySelectorAll(".css-radio")) var goods = radios.filter(function(element) { return element.value >= 5; }); for(var i = 0; i < goods.length; i++) { if (getRandomInt(0, 1) == 0) { goods[i].checked = true } else if (i+1 <= length) { goods[i+1].checked = true } }