JSFiddle - React, Tailwind, and code Playground
HTML
<style>
.tclass{
background:red;
}
</style>
<table border=1>
<tr><td id="id1" class="wer">td1</td>
<td id= "id9" class="rew">td2<td>
</tr>
</table>
<a href="#">href</a>
<script>
var p = "";
$('td').bind('click',
function(){
alert("p="+p);
p = this.getClass;
});
$('a').bind('click',
function(){
if(p) $("#"+p).toggleClass('tclass');
});
</script>