I have the script below where I am not sure how to prevent an entry whose any part of the name is numeric only. Example Fulano de Tal 123
returns me valid.
function formatar() {
var nome = document.getElementById("nome").value;
var partes = nome.split(' ');
var IsNumericString = partes.filter(function(i){
return isNaN(i);
}).length > 0;
if (IsNumericString == 0 ) {
alert("Digite seu nome corretamente");
}else{
alert("Nome OK");
}
}
document.querySelector("button").addEventListener('click', formatar);
<input id="nome" type="text" value="Fulano de Tal" />
<button>Formatar</button>