Reputation: 1
I was able to use jQuery to create a random number and put it in a <td>
. But can I make each <td>
have its own random number?
Upvotes: 0
Views: 1482
Reputation: 253328
I'd suggest:
$('td').text(function(){
return Math.random(); // or however you want to generate your random number
});
The above iterates through each td
element and sets its text independently of other td
elements, unlike:
$('td').text(Math.random());
Which sets the same random number to all the td
elements.
References:
Upvotes: 9