JSFiddle - React, Tailwind, and code Playground

HTML

<input type="text" value="value" id="textinput" />
<span id="hi">click</span>

JavaScript

document.getElementById("hi").addEventListener('click', function () {
    var text = document.getElementById('textinput');
    text.value = (text.value + ' after clicking');
});