jQuery Get Random Element From a Selection Returned By $(selector)
jquery, random
Solution
$.fn.random = function() {
return this.eq(Math.floor(Math.random() * this.length));
}
$(selector).random();
Problem
If `$('.my-element')` matches multiple element, is there a quick way to get a random element out of these?