On Tue, Mar 3, 2009 at 1:48 PM, Nic Hubbard <nnhubb...@gmail.com> wrote: > > Should I keep the division by 10 on the Math function?
No, as i said, that's the problem. There's not only no need for it, but it's giving you results you don't want. Quick: what's zero divided by ten? And what's the remainder of that result divided by 3? This should help to illustrate what's going on: $('#artistsColumns p').each(function(i){ var d = Math.floor(i/10); var n = d % 3; $(this).html('<strong>d:' + d + ' n:' + n + '</strong><br />' + $(this).html()); $(this).addClass(classNames[n]); });