jQuery.fn.randomOne=function(){ return this.eq( Math.floor(Math.random()*this.length)) }
hidden away in http://jqueryjs.googlecode.com/svn/trunk/plugins/traverseDir/jquery-traverseDir.js On 5/20/07, Remy Sharp <[EMAIL PROTECTED]> wrote:
Hi Domnik, There's a few ways, but this way should also do the trick (assuming you're targeting an LI): $('li:nth(' + parseInt(Math.random() * $('li').length) + ')').click(); Let us know how you get on. On May 20, 4:14 pm, MrNase <[EMAIL PROTECTED]> wrote: > I have a list with numerous list items and 'onclick' I want to have > one randomly selected item. > > How can I do this the jQuery way? > > dominik
-- Ⓙⓐⓚⓔ - יעקב ʝǡǩȩ ᎫᎪᏦᎬ