JSFiddle - React, Tailwind, and code Playground

by Alfie

HTML

<div id="staticParentElement">
<a href="#" id="delete">delete</a>
</div>

JavaScript

$('#staticParentElement').on('click','#delete',function(){
  $(this).attr('id','restore');
    $(this).text('newText');
});
$('#staticParentElement').on('click','#restore',function(){
alert(this.id);
});