JSFiddle - React, Tailwind, and code Playground

HTML

<div id="greet">TEST</div>
<div  title="fontType1" >Lucida</div>
<div  title="fontType2" >comic</div>

CSS

.fontType1{font-family:"Lucida Handwriting";}
.fontType2{font-family:"Comic Sans MS";}

JavaScript

$("div").click(function (){
    $("#greet").removeClass(font);
    var font = $(this).attr("title");
    $("#greet").addClass(font);
});