If $(\'.my-element\') matches multiple element, is there a quick way to get a random element out of these?
$(\'.my-element\')
var numElements = $('.my-element').length; var randomNum = Math.floor(Math.random()*numElements); //Select your random element $('.my-element:nth-child(' + randomNum + ')');