This is because you generate one random value and then use for each of td
s, and not generate a new one for each td
. So:
$td.each(function(i){
$td.eq(i).text(Math.random(Math.random() * 100));
});
In other words, generate a random value inside the loop, not outside it.
, , each
, .. this
, .
$td.eq(i).text(...
$(this).text(...