jQuery
1 2 3 4 5 6 7 8 |
$(document).ready(function(){ $("td").each(function(){ addFigure($(this)); }); function addFigure(elem){ elem.text(elem.text().replace( /(\d)(?=(\d\d\d)+(?!\d))/g, '$1,')); } }); |
HTML
1 2 3 4 5 6 7 8 9 |
<table class="table table_striped"> <tbody> <tr><th>A</th><td>1234567</td></tr> <tr><th>B</th><td>253749</td></tr> <tr><th>C</th><td>12423</td></tr> <tr><th>D</th><td>122</td></tr> <tr><th>E</th><td>53454</td></tr> </tbody> </table> |
デモ
A | 1234567 |
---|---|
B | 253749 |
C | 12423 |
D | 122 |
E | 53454 |
コメント