JSFiddle - React, Tailwind, and code Playground

by micmic

HTML

<input type="text" id="nom" />
<input type="button" id="bouton" value="valider le formulaire" onclick="valider()" />

JavaScript

function valider() {
    var nom = document.getElementById("nom").value;
    if (/^[a-zA-Z]+$/.test(nom)) {
        alert('Saisie validée ...');
    } else {
        alert('la valeur saisie ne correspond pas à un nom....');
    }
}