5

I try to define maxlength of a number input.

 <label class="item item-input">
 <i class="icon ion-android-call placeholder-icon"></i>
 <input type="number"  placeholder="Phone number " maxlength="8">
 </label>

How can i reesolve it please.

1
  • 1
    Thats true. You can use type tel then it works. By the way, if you use your app for ios then you didn't have number type. Commented Apr 22, 2016 at 21:10

2 Answers 2

8
   <input type="tel " maxlength="6">
Sign up to request clarification or add additional context in comments.

2 Comments

This is not an acceptable answer if using a web browser on the desktop as there is nothing to stop you adding letters into the field. There seems currently to be no solution for this scenario in Ionic so far :-(
Okay this link makes things clearer along with a workaround using maxlength and the pattern attribute of the input tag: stackoverflow.com/questions/18510845/…
4
 <input type="tel" pattern="[0-9]*" maxlength="6">

This will validate the numbers pattern too :)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.