All TalkersCode Topics

Follow TalkersCode On Social Media

devloprr.com - A Social Media Network for developers Join Now ➔

Input Type For Mobile Number In HTML

Last Updated : Mar 11, 2024

Input Type For Mobile Number In HTML

In this tutorial we will show you the solution of input type for mobile number in HTML, in HTML as we already say that there are many reasons of why we use numbers in html and one reason from them is entering and typing your mobile number.

Hence, there are several ways of typing a mobile number because there are several ways of typing a number.

But, there is also a unique tag or method which is used for every purpose and similarly for typing a number, there is an input type for mobile number. Which we are going to discuss in points that are given below.

Step By Step Guide On Input Type For Mobile Number In HTML :-

As, there are various ways of typing mobile number. But we choose here one that is input type. Hence, there is an input type for mobile number in html that is tel.

Yes, there is an input type whose name is tel that is used in html for typing mobile number. There are also some attributes that are used with this type that we are going to discuss in next sessions.

Here, below we give you a code in html, we hope that you are able to understand what we do here.

<!DOCTYPE html>
      <html>
        <head>
          <title> Title of the document<title>
   </head>
<body>
   <form action="demo10/business_feedback.html" method="get">
        <label for="">
            Please enter your enter your mobile number
        </label>
        <input type="tel" name="phone" id="phone" placeholder="0123-456-789">
        <br><br>
        <label for="">
            please enter your telephone number
        </label>
        <input type="tel" name="nmbr" id="nmbr" placeholder="0161-123456">
        <input type="submit">
    </form>
</body>
      </html>
  1. First, we write <! DOCTYPE html> which we used as an instruction to the web browser about what version of HTML file is written in.
  2. Secondly, the <html> tag is used to indicate the beginning of an HTML document.
  3. As above now <head> tag is used to contain information about web page. In this tag a <title> tag is used which helps us to specify a webpage title. Both <head> and <title> tags are Paired tags. So, both have </head> and </title> ending tags respectively.
  4. Thirdly, <body> tag is used to define the webpage body. All the contents to show on website are written here.
  5. Here, in body we created two Input tags in which we make two input tags and under this the type given is for telephone which is tel. Whereas the other attribute used here is for placeholder, so that the user should know what type of format is used to enter number.
  6. At last, the <body> and <html> tags are closed with </body> and </html> respectively.

Conclusion :-

In conclusion, here we want to say that with the help of this article you are able to type number from user.

But here one more condition arises what if user insert more than required digits then?

So, our next topic is about mobile number validation, I hope this tutorial on input type for mobile number in HTML helps you.