JSFiddle - React, Tailwind, and code Playground

HTML

<div id="a" onmouseover="chbg('red','b','underline','white')" onmouseout="chbg('white','b','none','black')">This will change b element</div>
<div id="b">This is element b</div>

<div id="f" onmouseover="chbg('blue','g','underline','white')" onmouseout="chbg('white','g','none','black')">This will change g element</div>
<div id="g">This is element g</div>

<div id="j" onmouseover="chbg('yellow','k','underline','white')" onmouseout="chbg('white','k','none','black')">This will change k element</div>
<div id="k">This is element k</div>

JavaScript

function chbg(color, id, td, fc) { 
    document.getElementById(id).style.backgroundColor = color;
    document.getElementById(id).style.textDecoration = td;
    document.getElementById(id).style.color = fc;
}