Categories
HTML

How to set value to currency in number input with HTML?

Spread the love

Sometimes, we want to set value to currency in number input with HTML.

In this article, we’ll look at how to set value to currency in number input with HTML.

How to set value to currency in number input with HTML?

To set value to currency in number input with HTML, we set the step attribute.

For instance, we write

<input type="number" min="0.01" step="0.01" max="2500" value="25.67" />

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

Conclusion

To set value to currency in number input with HTML, we set the step attribute.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

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