JSFiddle - React, Tailwind, and code Playground

by Pradeep Shankar

HTML

<button id="clcik">
  Show Alert
</button>
<br/><br/>
<div class="alert-message" style="display:none;">
  Test
</div>

JavaScript

$(document).ready(function() {
  $("#clcik").click(function() {
    showAlr();
  });
});

function showAlr() {
  $(".alert-message").fadeIn(function() {
    $(this).show();
  });

  window.setTimeout(function() {
    $(".alert-message").fadeOut(function() {
      $(this).hide();
    });
  }, 5000);
}