JSFiddle - React, Tailwind, and code Playground
HTML
<table>
<tr>
<td rowspan="2">First</td>
<td> First 1 1 </td>
<td> First 2 1 </td>
</tr>
<tr>
<td> First 2 1 </td>
<td> First 2 2 </td>
</tr>
<tr>
<td rowspan="2">Second</td>
<td> Second 1 1 </td>
<td> Second 2 1 </td>
</tr>
<tr>
<td> Second 2 1 </td>
<td> Second 2 2 </td>
</tr>
</table>
CSS
body {
font-family: Verdana, Arial, sans-serif;
font-size: 12px;
}
JavaScript
$(document).ready(function() {
$("td").click(function() {
var $this = $(this);
var rowIndex = $this.closest("tr").index();
$this.closest("table").find("tr").map(function() {
return $(this).find("td:first").attr("rowspan") || 1;
}).each(function(index) {
if ((rowIndex -= this) < 0) {
alert(index + 1);
return false;
}
});
});
});