JSFiddle - React, Tailwind, and code Playground

HTML

<input type="text" onfocus="myFunction()">

JavaScript

var input = document.getElementsByTagName("input")[0];

input.addEventListener("focus", function() {
    this.style.background = "yellow";
});