JSFiddle - React, Tailwind, and code Playground

HTML

<div class="edit-button">
Edit
</div>

JavaScript

$(function() {
    $('.edit-button').on('click', function(e) {
      $( this ).addClass('update-now').html('Update');
      $(this).off("click");
      e.stopPropagation();
    });
    
    $('body').on('click', ".edit-button.update-now", function() {      
      alert('hi');
  });
});