JSFiddle - React, Tailwind, and code Playground
HTML
<button>1</button>
<button>2</button>
<button>3</button>
CSS
button{
border:1px solid #ddd;
padding:5px 20px;
color:#fff;
}
JavaScript
$('button').on('click', function(){
$(this).replaceWith('<p>'+ $(this).text() +'</p>');
$(this).clone().appendTo('body');
});
$(document).on('click','button', function(){
$(this).replaceWith('<p>'+ $(this).text() +'</p>');
$(this).clone().appendTo('body');
});