JSFiddle - React, Tailwind, and code Playground

by tacman1123

HTML

<div>
    <textarea rows="5" cols="80">
      This is a test.  Inside of TEXT area.
    </textarea>
    <span>test</span>
</div>
<button>Update</button>

CSS

span {
    display:none;
}

JavaScript

$('button').on('click',function(){
    if($("textarea").is(":visible")) {  
        $("textarea").hide();
        $("span").text(
            $("textarea").val()
        ).show();
        $("button").text("Edit");
    } else {
        $("span").hide();
        $("textarea").text(
            $("span").val()
        ).show();
        $("button").text("Update");
    }

});