JSFiddle - React, Tailwind, and code Playground

by OlsonDev

HTML

<button type="button" id="someButton">Click</button>
<textarea id="someTextarea"></textarea>

CSS

textarea {
    display: block;
    width: 400px;
    height: 200px;
}

JavaScript

var element = document.getElementById('someTextarea');
var text = 'and things are';

$('#someButton').click(function() {
    var event = document.createEvent('TextEvent');    
    //event.initTextEvent('textInput', true, true, null, text);
    element.dispatchEvent(event); // fire the event on the the textarea
});