JSFiddle - React, Tailwind, and code Playground
by Andrea Forni
HTML
<button name="toHomepageButton" id="id1" class="frontpage">Remove from homepage</button>
JavaScript
$('.frontpage').on('click', function () {
var id = this.id;
$("#" + id).html($("#" + id).html() == "Promote to homepage" ? "Remove from homepage" : "Promote to homepage");
});