Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis+ 1
Form Validation (JavaScript)
I want to explicitly check that a user doesnāt input numbers in a name field... I ran this code to just test that it works on the console but it doesnāt. If I input numbers it the name field, the statement still fires... let fName = document.getElementById(āfNameā) fName = addEventListener(āchangeā, () => { If (fName !== typeof Text) { console.log(āenter alphabets onlyā); } });
6 Respostas
+ 2
This page has an example using RegEx, hope it helps
https://www.fwait.com/how-to-check-if-string-contains-numbers-in-javascript/
+ 1
What should happen when they type "George Edison the 5th" as name?
+ 1
Ipang It should throw an error. āGeorge Edisonā alone should suffice.
+ 1
Ipang Thank you very much šš¾
+ 1
Furqan_Elahie [Imaziue Coders] You rock! Thank you