JSFiddle - React, Tailwind, and code Playground
HTML
<form action="act_vowel.php" method="post" id="form">
<h2> <font color = "black"> Type the word: </font> </h2>
<input type="text" name="word" />
<input type="submit" name="check" value="Answer" />
</form>
JavaScript
var form = document.getElementById("form");
form.onsubmit = function () {
if (document.getElementsByName("word")[0].value.toLowerCase() == 'ship') {
alert('Your answer is correct.');
} else {
alert('Sorry, you typed the wrong answer. Try Again!');
return false;
}
}