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

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -