JSFiddle - React, Tailwind, and code Playground

HTML

<div>

    <span>If no background color is set on the Element, or its background color is set to 'transparent', the default end value will be white.</span>
    <br /><br />
    <input type="button" value="Click Me First!" class="btn"/> 
    <input type="button" value="This Close Button Works!" class="btn2" />    
</div>

CSS

div {
    margin: 20px 0;
}
textarea {
    width: 100%;
}

JavaScript

function divClicked() {
    $(this).parent().find('span').replaceWith('<input type="button" value="This Close Button Does Not Functions" class="btn3" />');
    $(this).hide();
}

function deActivate() {
    $(this).hide();
}

$('.btn').click(divClicked);


$(document.body).on( "click", ".btn3", function() {
    $('.btn2').hide();
});