JSFiddle - React, Tailwind, and code Playground
HTML
<a href="#" class="first" onclick="check(this.class)">change first row</a>
<a href="#" id="second" onclick="check(this.class)">change second</a>
<table>
<tr class="first">
<td>test1</td>
</tr>
<tr id="second">
<td>test2</td>
</tr>
</table>
JavaScript
function check(x) {
elements = document.getElementsByClassName(x);
for (var i = 0; i < elements.length; i++) {
elements[i].bgColor="blue"
}
}