Created
October 24, 2016 09:28
-
-
Save vayn/42557261a5467acd5cf394ceb72afee3 to your computer and use it in GitHub Desktop.
Aon
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 characters
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 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment