Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save ricardov03/34d9983ce1604a0c683d1db5bdc458e9 to your computer and use it in GitHub Desktop.

Select an option

Save ricardov03/34d9983ce1604a0c683d1db5bdc458e9 to your computer and use it in GitHub Desktop.
People underestimate the power of HTML. Here's how to allow decimals on HTML number fields.
<!-- How to allow Number fields to include decimals?
Use the step attribute. By reducing the default step to .01
you unleash the decimals allocation on Number fields. -->
<input type="number" step=".01" name="test" />
<!-- Do you need more Decimal places? Add more zeros.
You can include more leading positions by adding more left
zeros. -->
<input type="number" step=".001" name="test" />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment