I have a table like following code, I want at first the child tables not seen but when user click on the row the child table for other rows closed and child table under this row open.
How could I make this with jQuery?
<table class="mainTable">
<thead>
<tr class="header">
<th style="width:33%">col1</th>
<th style="width:33%">col2</th>
<th style="width:33%">col3</th>
</tr>
</thead>
<tr>
<td class="even" colspan="3">
<table class="childTable"">
<thead>
<tr>
<th style="width:33%">row1</th>
<th style="width:33%">row1</th>
<th style="width:33%">row1</th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
<td>t1-row1</td>
<td>t1-row1</td>
</tr>
<tr>
<td></td>
<td>t1-row2</td>
<td>t1-row2</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td class="odd" colspan="3">
<table class="childTable" >
<thead>
<tr>
<th style="width:33%">row2</th>
<th style="width:33%">row2</th>
<th style="width:33%">row2</th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
<td>t2-row1</td>
<td>t2-row1</td>
</tr>
<tr>
<td></td>
<td>t2-row2</td>
<td>t2-row2</td>
</tr>
</tbody>
</table>
</td>
</tr>
</table>