Shaik
Shaik

Reputation: 49

Ion input type number is allowing dots in an ionic form

I am working on an ionic app. In one of the form field i have to input mobile number, below is the code i written

<ion-label position="floating">Mobile No.</ion-label>

<ion-input type="number" inputMode="numeric" pattern="[0-9]*" ></ion-input>

iam getting numerical keypad and allowing numbers but it allowing dot (.) also. I want to input only numbers.

please help me on this

Thank you

Upvotes: 0

Views: 7496

Answers (1)

Shinichi Kudo
Shinichi Kudo

Reputation: 344

If you want a phone number, you should use <ion-input type="tel">

Like the doc said here : https://ionicframework.com/docs/api/input

Upvotes: 1

Related Questions