How to force decimal point instead of comma in HTML5 number input?

Spread the love

Sometimes, we want to force decimal point instead of comma in HTML5 number input.

In this article, we’ll look at how to force decimal point instead of comma in HTML5 number input.

How to force decimal point instead of comma in HTML5 number input?

To force decimal point instead of comma in HTML5 number input, we set the step attribute.

For instance, we write

<input type="number" step="0.01" min="0" lang="en" value="1.99" />

to set the step attribute to 0.01 to let us enter 2 decimal places.

Conclusion

To force decimal point instead of comma in HTML5 number input, we set the step attribute.

Leave a Reply

Your email address will not be published. Required fields are marked *