JSFiddle - React, Tailwind, and code Playground

HTML

<input type="text" id="put">

CSS

@keyframes an {
    from {background-color: white;}
    to {background-color: yellow;}
}

/* The element to apply the animation to */
.animate {
    animation-name: an;
    animation-duration: 4s;
    animation-iteration-count: infinite;
}

JavaScript

put.onclick = function()  {
	this.classList.add('animate');
  
  setTimeout(function() {
  	put.classList.remove('animate');
  }, 4000);
};