Question
How to get random element in jquery?
How can I return a random element in jQuery by doing something like $(.class).random.click()
?
So, if .class
had 10 links, it would randomly click one of them.
Here is what I did:
var rand_num = Math.floor(Math.random()*$('.member_name_and_thumb_list a').size());
$(".member_name_and_thumb_list a").eq(rand_num).click();
45 63571
45