Skip to content

Instantly share code, notes, and snippets.

@lemnis
Created April 19, 2018 10:08
Show Gist options
  • Save lemnis/7434e7fa255a2632ba5771ba6601ea18 to your computer and use it in GitHub Desktop.
Save lemnis/7434e7fa255a2632ba5771ba6601ea18 to your computer and use it in GitHub Desktop.
Bashing on the web

input[type='number'] doesn't support the pattern property, even though iOS uses it.

You should use <input type="number" pattern="[0-9]*">.

What it does

  • Show a numeric keyboard for iOS
  • Remove the ability to enter decimal numbers within iOS

What it doesn't do

  • Disallow to use decimal number or the e character.
  • Add validation on the regex pattern
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment