JSFiddle - React, Tailwind, and code Playground

HTML

<button class="save">Save <code>dataItem</code> to this button</button>

JavaScript

$(".save").on("click", function () {
    var dummy = $(this).data("dummy");
    if (dummy) {
        return alert(dummy);
    }
    
    $(this).data("dummy", "I am a button");
    var $clone = $(this).clone();
    $(this).after($clone);
});