JSFiddle - React, Tailwind, and code Playground
HTML
<FORM NAME="myform" ACTION="" METHOD="GET">Age: <BR>
<INPUT TYPE="text" NAME="age" VALUE=""><P>
<INPUT TYPE="button" NAME="button" Value="Click" onClick="checkMyAge(form)">
</FORM>
JavaScript
function checkMyAge(form) {
var age = form.age.value;
if (age >= 21) {
alert("Over 21! Age tested:" + age);
}
else {
alert("Under 21! Age tested:" + age);
}
}