climboid
climboid

Reputation: 6952

html5 input type text with regex for pattern in mobile

Hi so I'm trying to get a pattern for an input type text that shows numbers and a dot. Going over the apple documentation I see that one can use basically regex to pull only numbers in the keyboard. Something like

<input type="text" pattern="[0-9]*"></input>

I'm looking for a way to have exactly this but also a dot in the keyboard. Any ideas are much appreciated.


Thanks

Upvotes: 1

Views: 5578

Answers (1)

Explosion Pills
Explosion Pills

Reputation: 191729

Just include a dot in the character class.

[0-9.]*

Note that this is also "zero or more digits and dots."

Upvotes: 1

Related Questions