JSFiddle - React, Tailwind, and code Playground
HTML
<table id="SubstancesWithMissingSwedishSubstanceName" class="controlTable">
<thead>
<tr class="rowToClick1">
<th title="Expandera/Minimera">Substance id:</th>
</tr>
</thead>
<tbody>
<tr class="rowToExpand1">
<td>data here...</td>
</tr>
</tbody>
</table>
<hr />
<table>
<thead>
<tr class="rowToClick2">
<th title="Expandera/Minimera">Substance id:</th>
</tr>
</thead>
<tbody>
<tr class="rowToExpand2">
<td>data here...</td>
</tr>
</tbody>
</table>
CSS
table {
border: 1px solid black;
}
.rowToClick1 {
cursor: pointer;
}
.rowToClick2 {
cursor: pointer;
}
JavaScript
$('tr[class^="rowToClick"]').click(function () {
theNumber = $(this).attr('class').replace(/\D/g,'');
$(".rowToExpand"+theNumber).toggle();
});