JSFiddle - React, Tailwind, and code Playground
HTML
<textarea id="myTextBox"></textarea>
<br/>
<input type="button" name="Button" value="Click Me" onclick="substitute();">
JavaScript
function substitute() {
var myVal = document.getElementById('myTextBox').value;
if (myVal.length == 0) {
alert('Empty Textbox');
}
}