Neznajka,
<!DOCTYPE html>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
<style type="text/css">
</style>
<script>
document.addEventListener("DOMContentLoaded", function() {
let table = document.querySelector("table");
table.addEventListener("click", function({
target
}) {
let selection = document.getSelection(),
node = selection.baseNode;
target = target.closest("td");
if (node.nodeType == 3 && target) {
let childNodes = [...target.childNodes].filter(node => node.nodeType == 3);
let index = childNodes.findIndex(el => el === node);
alert(index);
}
})
})
</script>
</head>
<body>
<table border="1">
<tr>
<td>
строка 1 <br/> строка 2 <br/> строка 3
</td>
<td>
пусто
</td>
</tr>
<tr>
<td>
строка 1 <br/> строка 2 <br/> строка 3 <br/> строка 4 <br/> строка 5
</td>
<td>
пусто
</td>
</tr>
</table>
</body>
</html>