JSFiddle - React, Tailwind, and code Playground
HTML
<table onclick='
if (window.getSelection) {
if (window.getSelection().anchorNode.nodeType == 3) {
console.log("this is a text node");
} else {
window.getSelection().removeAllRanges();
}
}'>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
</tr>
<tr>
<td>4</td>
<td>5</td>
<td>6</td>
</tr>
</table>
CSS
*::-moz-focus-inner {
border: 0;
}
table {
border-collapse: collapse;
}
table tr td {
border: 1px solid gray;
padding: 5px;
}