I have an issue with getting dimensions of a table in jQuery.
I have table which is generated from a loop like this:
if(something) {
echo '<tr class="trclass" height="'.$a['percentHeight'].'%" colspan="'.$a['col_span'].'">';
}
if(something else) {
echo '<td class="tdclass" width="'.$a['percentWidth'].'%" rowspan="'.$a['row_span'].'">';
if (condition == 1) echo $action['1'];
if (condition == 2) echo $action['2'];
if (condition == 3) echo $action['3'];
}
echo '</td>';
Where col,row_span and width and height and action are form database.
On every page this table might be different.
Dimensions of a table's skeleton are fine and actions are displaying in appropriate cells, but I want to fit the action dimensions to the cell dimensions.
But when I try to only display in the console the hight of each cell like this:
$('#table tr').each (function() {
console.log($('td').height());
or this:
$('.tdclass').each (function() {
console.log($(this).height());
it's displaying only one number and I can't change the css of each cell. Can someone tell me how to do this properly?