I have a simple table that has this structure:
<table>
<thead>
<tr>
<td>Some info</td>
<td>Some info</td>
<td>Some info</td>
</tr>
</thead>
<tbody>
<tr>
<td>Some info</td>
<td>Some info</td>
<td>Some info</td>
</tr>
</tbody>
<tbody>
<tr>
<td>Some info</td>
<td>Some info</td>
<td>Some info</td>
</tr>
</tbody>
<thead>
<tr>
<td>Some info</td>
<td>Some info</td>
<td>Some info</td>
</tr>
</thead>
<tbody>
<tr>
<td>Some info</td>
<td>Some info</td>
<td>Some info</td>
</tr>
</tbody>
</table>
I want to count how many tbody‘s exist between two thead‘s using jQuery (or plain Javascript). Is there any way of doing this?
You can make a generic function
Use:
Note
Your markup is wrong, avoid it.