+ 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)
3 Answers
+ 7
<input type="number" /> ( 1,2,3)
<input type="text" /> (A,B,C)
<input type="password" /> (*,*,*)
+ 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:
+ 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>