My blog

The World is too big and beautiful to stay in one place forever!

Input type for a phone number

In this post, I will show you how I fixed a small bug in my contact form, which I built in React. At first I tried to use <type=”number”>

React code

and here is what I got.

React form

Then I found out that there is an <input> element which has a type=”tel” and you can use it with a pattern.

contact form

So when I am trying to use a string or more numbers after applying it an error shows up.

I got a feeling of shame when I discovered it. But last time I am trying to adopt a growth mindset and feel joy when I make a mistake because It helps me to learn something new.

Naika

Leave a Reply

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

Back to top