JSFiddle - React, Tailwind, and code Playground

HTML

<a href="#" class="change">Old Text</a>
<br />
<a href="#" class="change">Old Text</a>

JavaScript

// add a refresh button to image previews
$(".change").on("click", function () {
    var oldText = $(this).html();
    var that = $(this)
    $(this).html("new text");
    setTimeout(function () {
        that.html(oldText);
    }, 2000);
})