JSFiddle - React, Tailwind, and code Playground

HTML

<div id="click">Click to insert</div>
<textarea id="info">I want to</textarea>

JavaScript

$.fn.setCaretToEnd = function () {
    return this.each(function () {
        if (this.setSelectionRange) {
            this.focus();
            this.setSelectionRange(this.value.length, this.value.length);
        } else if (this.createTextRange) {
            var range = this.createTextRange();
            range.collapse(true);
            range.moveEnd('character', this.value.length);
            range.moveStart('character', this.value.length);
            range.select();
        }
    });
};

$(document).ready(function () {
    $('#click').on('click', function () {
        var i = $('#info').val();
        var n = "Insert this";
        
        $('#info').val(i + n).focus().setCaretToEnd();
    });
});