JSFiddle - React, Tailwind, and code Playground

by Сергей Тарасевич

HTML

<div class="ui-dialog-buttonset">
    <button type="button">Отмена</button>
    <button type="button">Сохранить</button>
</div>

JavaScript

$("button").click(function () {
    var btn = $(this).html();

    if (btn == "Сохранить") {

        $(this).after('<span class="load_buttonset" style="display:none;">Подождите...</span>');
        $(this).addClass("btnFadeOut");
        $(this).fadeOut();

        setTimeout(function () {
            $(".load_buttonset").fadeIn();
        }, 400);

        setTimeout(function () {

            $(".load_buttonset").fadeOut();

            setTimeout(function () {
                $(".load_buttonset").remove();
                $(".btnFadeOut").fadeIn();
                $(".btnFadeOut").removeAttr("class");
                $(".btnFadeOut").removeAttr("style");
            }, 400);

        }, 1600);
    }

});