JSFiddle - React, Tailwind, and code Playground
HTML
<span>This is a span.</span>
<button id="hide">hide</button>
<button id="show">show</button>
CSS
span {white-space: nowrap; display: none; }
JavaScript
function hide() {
$("span").animate({width: "hide"}, 2000);
}
function show() {
$("span").animate({width: "show"}, 2000);
}
$('#hide').click(hide);
$('#show').click(show);