JSFiddle - React, Tailwind, and code Playground
HTML
<div id="test"></div>
JavaScript
var id_box = document.createElement('input');
id_box.id = 'id_box'
id_box.type = 'text';
id_box.onchange = function()
{
alert("Changed!");
}
var a = document.createElement('a');
a.innerHTML = "A";
a.onclick = function()
{
document.getElementById('id_box').value = 'A';
}
document.getElementById("test").appendChild(id_box);
document.getElementById("test").appendChild(a);