In HTMLif you want to restrict to your form that block should include only numbers how do you do it | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

In HTMLif you want to restrict to your form that block should include only numbers how do you do it

19th Mar 2019, 10:28 AM
Kate Mariette Skosana
Kate Mariette Skosana - avatar
3 Answers
+ 2
If you're asking for a way to allow user to enter only number to your text field, you can simply use type attribute in input tag. Set value of type attribute to number to enable number pad on mobile devices. //For example <form> <label>Your name:</label> <input id="user" name="username" type="number" /> </form>
19th Mar 2019, 10:34 AM
Raj Chhatrala
Raj Chhatrala - avatar
0
thank you
19th Mar 2019, 10:35 AM
Kate Mariette Skosana
Kate Mariette Skosana - avatar
0
hy but it still allowing letters.
19th Mar 2019, 10:39 AM
Kate Mariette Skosana
Kate Mariette Skosana - avatar