jQuery center specific table columns -
i have host of legacy code need adapt don't have time modify.
is possible have jquery 'center' contents of table column if don't have id, name or class.
<table> <tr><td>text</td><td>col2</td><td>col3</td></tr> <tr><td>text</td><td>col2</td><td>col3</td></tr> <tr><td>text</td><td>col2</td><td>col3</td></tr> </table> what wondering if possible center contents of 2nd , 3rd columns, parent/ child example i'm not sure if possible.
i go , recode tables (which hard coded on .php page) take hours!
try this:
$('tr').each(function() { var tds = $(this).find('td'); var len = tds.length; (var = 1; < len; i++) { $(tds[i]).css('text-align', 'center'); } });
Comments
Post a Comment