JSFiddle - React, Tailwind, and code Playground

HTML

<form>
    <button type="submit">Submit</button>
</form>

CSS

form.is-loading::after {
    content: ' Loading... ';
}

JavaScript

$('form').on('submit', function(event) {

  // Prevent the form from submitting
  event.preventDefault();

  // 'this' is referring to the event target
  var form = this;

  // It may not be required to wrap the `form.submit` method but it's usually safer to do so
  setTimeout(function() {
    form.submit();
  }, 4000);
    
  // Add a hook to display something useful
  form.className = 'is-loading';

});