I have the following jsfiddle ready to show you my problem
`https://jsfiddle.net/rwurzer/no4sefyu/`
Well, I know that you've already got an answer by try this variant. It's based on calculating indexes and should work for any cell. And I've removed duplicate id
attributes in jsFiddle.
$('td').click(function(){
var clickedEl = $(this);
var myCol = clickedEl.closest("td").index();
var myRow = clickedEl.closest("tr").index();
var rowspans = $("td[rowspan]");
rowspans.each(function () {
var rs = $(this);
var rsIndex = rs.closest("tr").index();
var rsQuantity = parseInt(rs.attr("rowspan"));
if (myRow > rsIndex && myRow <= rsIndex + rsQuantity - 1) {
myCol++;
}
});
alert('Row: ' + myRow + ', Column: ' + myCol);
});
Here is a demo in jsFiddle. Just want to solve your problem with this approach =).