Skip to content

Instantly share code, notes, and snippets.

@vayn
Created October 24, 2016 09:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save vayn/42557261a5467acd5cf394ceb72afee3 to your computer and use it in GitHub Desktop.
Save vayn/42557261a5467acd5cf394ceb72afee3 to your computer and use it in GitHub Desktop.
Aon
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