Dzh*_*eyt 9 random jquery
如果$('.my-element')匹配多个元素,是否有一种快速的方法可以从中获取随机元素?
$('.my-element')
und*_*ned 26
$.fn.random = function() { return this.eq(Math.floor(Math.random() * this.length)); } $(selector).random();
归档时间:
12 年,5 月 前
查看次数:
6506 次
最近记录:
10 年,10 月 前