Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Random div inside random div function Reply To: Random div inside random div function

#265505
Shikkediel
Participant

This should do the trick:

var numItems = $('section'),
random = Math.floor(Math.random()*numItems.length)+1,
chance = Math.floor(Math.random()*numItems.eq(random-1).find('article').length);