jquery accessing dynamic class selectors
- by dinotom
Given the following html rendering;
<fieldset id="fld_Rye">
 <legend>7 Main St.</legend>
<div>
    <table>
        <tr>
        <th class="wideCol"><b><i>Service Description</i></b></th>
        <th class="wideCol"><b><i>Service Name</i></b></th>
        <th class="normalPlusWidth"><b><i>Contact Name</i></b></th>        
    </tr>
    <ItemTemplate>
        <tr class="">
        <td class="servDesc"> <b>Plumbing Services</b></td>
                    <td class="servName"> <b>Flynnsters's Plumbing</b></td>
                    <td class="servContact"> <b>Jim Flynnster</b></td>
        </tr>
    </ItemTemplate>
I am trying to access all the td's with a class of servDesc, get their width into an array and get the max width from that array to reset the css width of that class using jquery on page load. I cant seem to get the right selector for those tags, and I've tried at least 50 variations.
My latest try;
 var maxTdWidth;
        var servDescCols = [];
        $("#fld_Rye td#servDesc").each(function () {
            alert("found one");
            servDescCols.push(this.width());
        });
        maxTdWidth = Math.max.apply(Math, servDescCols);