JSFiddle - React, Tailwind, and code Playground

by raphaelwilker

HTML

<input type="text" id="myTextField" value="Text field." style="display: none;">
<p></p>
<button type="button" onclick="focusMethod()">Click me to focus on the text field!</button>

CSS

button{
  margin-top: 50px;
}

JavaScript

focusMethod = function getFocus() {
	document.getElementById("myTextField").style.display="block";
  document.getElementById("myTextField").focus();
}