Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

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

share|improve this question

1 Answer

Just include a dot in the character class.

[0-9.]*

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

share|improve this answer
yeah this gives me the normal keyboard. I'm looking for the phone keyboard but also with a dot – climboid Mar 8 at 23:27
@climboid have you tried type=number? – Explosion Pills Mar 8 at 23:29
yeah I think this is the only option all though it gives me everything else not just numbers and a dot. Thanks for that! – climboid Mar 8 at 23:43

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.