JSFiddle - React, Tailwind, and code Playground

by Shu Ding

HTML

<textarea id="textarea"></textarea>
<input type="submit" id="replace" value="replace"/>

JavaScript

$("#replace").click(function(){
    var t = $("#textarea");
    var s = t.val();
    
    s = s.replace(/,/g, ", ");
    // ...
    
    t.val(s);
})