JSFiddle - React, Tailwind, and code Playground

HTML

<input id="test" type="text"><div id="dopple"></div>

JavaScript

var d = document.getElementById("dopple");
document.getElementById("test").onkeydown = function () {

    var self = this;
    
    window.setTimeout(function () {
        if ("textContent" in d)
            d.textContent = self.value;
        else
            d.innerText = self.value;
    }, 0);
        
};