I want the user to enter the correct sum and verify that. On completion of verification it will bring a text file.
<fieldset>
<legend style="font-size: 30px; color: red;">Verification table</legend>
<form>
<label>The sum of 7 + 2 : </label> <input type="number" id="inputNumberBox" />
<button type="submit" id="submitBtn" onsubmit="myFunction()">Hit me Baby!!
</button>
</form>
</fieldset>
function myFunction() {
var inputValue = document.getElementById("inputNumberBox").value;
function checkValidation() {
if (inputValue == 9) {
var client = new XMLHttpRequest();
client.open('GET', '/testText.txt');
client.onreadystatechange = function() {
alert(client.responseText);
}
client.send();
} else {
window.alert("Try again");
}
}
clickButton.addEventListener("click", checkValidation, false);
}