Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

maxlength not working with input type="number" ionic

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.

like image 930
Sihem Hcine Avatar asked Apr 22 '16 21:04

Sihem Hcine


2 Answers

   <input type="tel " maxlength="6">
like image 131
Mohsin Muzawar Avatar answered Oct 01 '22 09:10

Mohsin Muzawar


 <input type="tel" pattern="[0-9]*" maxlength="6">

This will validate the numbers pattern too :)

like image 28
Syed Muhammad Abid Avatar answered Oct 01 '22 09:10

Syed Muhammad Abid