JSFiddle - React, Tailwind, and code Playground

HTML

<button id="edit" name="edit">Edit</button>

JavaScript

$(function() {
    $button = $('button[name="edit"]');
    $button.on('click', $button, function() {
        var $that = $(this);
        $that.text('Save Changes');
        $that.addClass('js-editing');
        if ($that.hasClass('js-editing')) {
            $that.off('click').on('click', $that, function() {
                alert('Saved!');
                $that.text('Edit');
                $that.removeClass('js-editing');
            });
        }
    });
});