I have this code that generates a table row:
var tr = $('<tr></tr>').attr('id', 'PO');   
    tbody.append(tr);
    for( var i=0; i < $numCols; ++i)
        {
        var th = $('<th></th>').addClass('r90').attr('id', 'th1' + i);
        var sp = $('<span></span>').text($headers1[i]); 
        if(i == 6)
            {
            th.addClass('biggerText borderCell2 selectable');
            }
        if(i > 6 && i < 13 )
            {
            th.addClass('borderCell2 smallerText selectable isHeader');
            }
        if(i > 12)
            {
            th.addClass('borderCell1 smallerText selectable');
            }
        th.append(sp);
        tr.append(th);
        }
And this function that gets the largest width
function getLargest(id)
    {
    $largestWidth = 0;
    $('#' + id + ' th').each( function() {
        if( $(this).width() > $largestWidth)
            {
             $largestWidth = $(this).width();
            }
    }); 
    alert($largestWidth);
    //$('#' + id).css('height', $largestWidth);
    }
Currently the id that I send is 'PO' and iterate over each th in there.
.r90 is a class that rotates the text 90 degrees so that it is shown vertical.
I used to have this function working when the table was statically made in an html file but now that I am generating the table dynamically, I cannot get it to work.
What I need in the end is to know how many px the biggest span takes up so that I can set the height of that row appropriately.