0

Input field validation

I want to design a input field for mobile no which should only accept 10 digit number not character If mobile no is less than 10 error should be come .And also ensure at the last of that input box. Like this symbol ^ shouldn't exist . ^ this is number increase and decrease symbol which comes when you define input type number . Give me solution.

11th Sep 2019, 3:08 PM
Rajnish Kumar Mishra
Rajnish Kumar Mishra - avatar
1 Réponse
+ 2
<input type="tel" maxlength="10"> Easiest way 😅 that I know. User will get prompted with a numeric keyboard . https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/tel //for errors use js. you can get length of input string and if it's less than 10 you can alert for errors.
11th Sep 2019, 3:25 PM
🇮🇳Omkar🕉
🇮🇳Omkar🕉 - avatar