JSFiddle - React, Tailwind, and code Playground

HTML

<form>
<input id="text1" type="text" onkeypress="changeColor()">
</form>

JavaScript

function changeColor()
    {
    
    document.getElementById("text1").style.backgroundColor = "red";
    }