[jQuery] Setting Rowspan Of Dynamic Table

[jQuery] Setting Rowspan Of Dynamic Table


I have a table which is dynamically created in html. I have pasted an
example below:
<table>
<thead>
<tr>
<th>Team</th>
<th>Designation</th>
<th>Name</th>
</tr>
</thead>
<tr id="ADM">
<td class="team">ADM</td>
</tr>
<tr class="ADM">
<td class="desig">Partner</td>
<td class="name">Gus</td>
</tr>
<tr class="ADM">
<td class="desig">Solicitor</td>
<td class="name">Mark</td>
</tr>
<tr id="VB">
<td class="team">VB</td>
</tr>
<tr class="VB">
<td class="desig">Partner</td>
<td class="name">Vincent</td>
</tr><tr class="VB">
<td class="desig">Solicitor</td>
<td class="name">Fiona</td>
</tr>
</table>
The idea is that a row will be given an ID, for example "ADM" and then
each row below that has a class of the same name, until a new row is
given a new ID, in this case, "VB".
What I want to do is set the rowspan of each tr with an ID to the
number of rows below it.
So, I guess to put it in jQuery speak, I'd like to traverse the table,
setting the rowspan of any tr with an ID, to the number of rows below
it which have a class matching the ID.
Hope that makes sense!
Thanks










































    • Topic Participants

    • david