JSFiddle - React, Tailwind, and code Playground

by j08691

HTML

<form> <strong>FULLNAME: </strong>
    <input type="text" / id="name">
    <br /> <strong>PHONE NR: </strong>
    <input type="text" id="phone" onblur="validateForm()" /> <strong>NATIONALITY</strong>
    <input type="text" id="nat" />
    <br />
    <input type="button" id="subButton" onclick="calc()" value="Submit" />
</form>

JavaScript

function validateForm() {
    checkNr = isNaN(document.forms[0].elements[1].value);
    if (checkNr == true) {
        window.alert("You can only enter numbers. Please try again")
    }
}