How can I restrict users to insert only numerics or alphabets in a form? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grátis
+ 1

How can I restrict users to insert only numerics or alphabets in a form?

Like in Mobile no.(only numerics) Or Name(only alphabets)

19th Jul 2019, 6:13 AM
Nilajit Sinha
Nilajit Sinha - avatar
3 Respostas
+ 7
<input type="number" /> ( 1,2,3) <input type="text" /> (A,B,C) <input type="password" /> (*,*,*)
19th Jul 2019, 6:26 AM
No activity
+ 2
Use the input tag and specify the type as text or number. Ex:-<input type="password"> defines a password field: <input type="text"> defines a one-line text input field:
19th Jul 2019, 6:18 AM
Ankul Chaudhary
Ankul Chaudhary - avatar
+ 1
You can use in code as follows <form>   First name:<br>   <input type="text"name="firstname"><br>   Last name:<br>   <input type="text"name="lastname"> </form>
19th Jul 2019, 6:19 AM
Ankul Chaudhary
Ankul Chaudhary - avatar