JSFiddle - React, Tailwind, and code Playground
HTML
<table id="exampletoto" class="display" cellspacing="0" width="100%" height:"300px";>
<thead>
<tr>
<th>Author</th>
<th>Organization</th>
<th>Nb docs</th>
</tr>
</thead>
<tbody>
<tr>
<td id="author1">Tiger Nixon</td>
<td>System Architect</td>
<td>2</td>
</tr>
<tr>
<td id="author2">Garrett Winters</td>
<td>Accountant</td>
<td>8</td>
</tr>
<tr>
<td id="author3">Ashton Cox</td>
<td>Junior Technical Author</td>
<td>8</td>
</tr>
<tr>
<td id="author4">Cedric Kelly</td>
<td>Senior Javascript Developer</td>
<td>99</td>
</tr>
<tr>
<td id="author5">Airi Satou</td>
<td>Accountant</td>
<td>89</td>
</tr>
<tr>
<td id="author6">Brielle Williamson</td>
<td>Integration Specialist</td>
<td>4</td>
</tr>
<tr>
<td id="author7">Herrod Chandler</td>
<td>Sales Assistant</td>
<td>3</td>
</tr>
<tr>
<td id="author8">Rhona Davidson</td>
<td>Integration Specialist</td>
<td>68</td>
</tr>
<tr>
<td id="author9">Colleen Hurst</td>
<td>Javascript Developer</td>
<td>2</td>
</tr>
<tr>
<td id="author10">Sonya Frost</td>
<td>Software Engineer</td>
<td>758</td>
</tr>
<tr>
<td id="author11">Jena Gaines</td>
<td>Office Manager</td>
<td>3</td>
...
CSS
tbody tr {cursor: pointer;}
tbody tr:hover {color: #fff;background: #000;}
JavaScript
document.getElementById("exampletoto").onclick = function(e) {
if (e.target.tagName.toLowerCase() == 'td'){
alert(e.target.parentNode.childNodes[1].innerHTML);
}
}