JSFiddle - React, Tailwind, and code Playground

HTML

<script>
function testar(){
	if (!(document.getElementsByName("texto")[0].value == "")){
  	alert("foi");
  }
  else{
  	alert("n foi");
  }
}
</script>

<input type="text" name="texto">
<button type="button" onclick="testar()">Enviar</button>