JSFiddle - React, Tailwind, and code Playground

HTML

<textarea id="myTextArea" rows="12" readonly="7" class="form-control"></textarea>

JavaScript

function appendToTextArea(id, text, stayOnCurrentLine) {
    var current = $(id).val();
    var newStatus = "";
    var newText = current + ' ' + text;
    if (!stayOnCurrentLine) {
        newStatus += '\n';
    }
    $(id).val(newText + newStatus);

    console.log($(id).val());
}
appendToTextArea('#myTextArea', 'Hello', false);
appendToTextArea('#myTextArea', 'How', false);
appendToTextArea('#myTextArea', 'are', false);
appendToTextArea('#myTextArea', 'you', false);