JSFiddle - React, Tailwind, and code Playground
HTML
<div id="testit">
<div style="display: none;" class="loading">
My loading message
</div>
<div class="formstuff">
<input type="text" /><br />
<input type="text" /><br />
<input type="text" /><br />
<input type="text" /><br />
<input type="text" /><br />
<input type="text" /><br />
<input type="text" /><br />
<input type="button" id="showhide" />
</div>
</div>
JavaScript
$(document).ready(function(){
$("#showhide").click(function(){
$(".formstuff").fadeOut().promise().done(function() {
$('.loading').fadeIn();
});
return false;
});
});