JSFiddle - React, Tailwind, and code Playground
by BramVanroy
HTML
<p id="labalt">Click</p>
JavaScript
$("#labalt").click(function() {
$(this).toggleClass("fact star barr");
if ($(this).hasClass("fact")) {
$("#build_title").html("Factory");
}
else if ($(this).hasClass("star")) {
$("#build_title").html("Starport");
}
else {
$("#build_title").html("Barracks");
}
});