JSFiddle - React, Tailwind, and code Playground
by karim79
HTML
<div class="test">
asdfasdfasdf_off
</div>
JavaScript
$(".test").hover(function () {
$(this).text(($(this).text().indexOf("_off") > -1) ? $(this).text().replace("_off", "on") : $(this).text().replace("_on", "off"));
});