How to fix “Invalid form control” only in Google Chrome with HTML?

Spread the love

Sometimes, we want to fix "Invalid form control" only in Google Chrome with HTML.

In this article, we’ll look at how to fix "Invalid form control" only in Google Chrome with HTML.

How to fix "Invalid form control" only in Google Chrome with HTML?

To fix "Invalid form control" only in Google Chrome with HTML, we set the step and pattern attributes.

For instance, we write

<input type="number" min="0" pattern="[0-9]*" step="1" />

to set the pattern attribute to the number regex pattern to validate against.

And we set the step attribute to 1 to let users increment or decrement the number by 1 when clicking on the arrows.

Conclusion

To fix "Invalid form control" only in Google Chrome with HTML, we set the step and pattern attributes.

Leave a Reply

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