Skip to content

Instantly share code, notes, and snippets.

@dangkhoasdc
Created January 14, 2015 04:13
Show Gist options
  • Save dangkhoasdc/0511ebeaa335812fc937 to your computer and use it in GitHub Desktop.
Save dangkhoasdc/0511ebeaa335812fc937 to your computer and use it in GitHub Desktop.
jQuery('.question-rankings').each(function(){ var choices = $(this).find('input');
var index = Math.floor(Math.random() * 3 + 1) + 1;
choices.get(index).checked = true;
});
jQuery('.question-answers').each(function(){
var choices = $(this).find('input');
var index = Math.floor(Math.random() * 2 + 2);
choices.get(index).checked = true;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment