JSFiddle - React, Tailwind, and code Playground

HTML

<textarea id="foo"></textarea>
<input type="button" id="bar" value="append" />

JavaScript

(function($){
    $.fn.extend({
        valAppend: function(text){
            return this.each(function(i,e){
                var $e = $(e);
                $e.val($e.val() + text);
            });
        }
    });
})(jQuery);

$('#bar').click(function(){
    $('textarea').valAppend('Hello, world!\r\n');
});