Reputation: 63
How to calculate table th width in percentage and assign that width to table tbody td using javascript ?
$('#headerwidth').find('thead th').each(function(){
var rowval = $(this).outerWidth()+'px' ;
Upvotes: 1
Views: 411
Reputation: 1855
You probably need to write one loop inside current loop on thead
:
$('#headerwidth').find('thead th').each(function(){
var rowval = $(this).outerWidth()+'px' ;
$('#headerwidth').find('tbody tr td').each(function(){
$(this).css("width", rowval)
});
});
Upvotes: 2