automatically pick random select choices in web form
I have a page with a bunch of radio fields. How can I create a script that will loop through each select group and pick a开发者_运维技巧 random choice from each.
I already have sections of the site implemented with scriptaculous, which has known jquery compatibility issues.
Something like this should work with Prototype / Scriptaculous:
$$('select').each(function(item){
item.selectedIndex = Math.floor(Math.random() * (item.length - 1));
});
精彩评论