JSFiddle - React, Tailwind, and code Playground

Different alert depending on text input onclick.

by Matt Reynolds

HTML

<input type="text" id="texty" placeholder="type" />
<button id="press">
Press Me
</button>

JavaScript

document.getElementById("press").onclick = function() {
var textRead = document.getElementById("texty").value;
if (textRead ==""){
alert("Where is your text MOFO?");
}else {
alert ("Nice Input");
}
};