Dofactory.com
Dofactory.com

HTML <input> type="tel"

The <input> tag with a type="tel" attribute creates an input field for a telephone number.

Telephone fields are not automatically validated because of the variety of phone number formats across the world.

Example

#

An <input> element of type tel.
This field accepts telephone numbers that match a pattern. An example is 333-444-5555.

Telephone

<form action="/tutorial/action.html">
  <fieldset>
    <legend>Telephone</legend>

    <input type="tel" name="tel" value="333-444-5555"
           pattern="[0-9]{3}-[0-9]{3}-[0-9]{4}"><br /><br />

    <input type="submit" value="Submit">
  </fieldset>
</form>

Using input type="tel"

The <input type="tel"> creates a telephone number input field.

Telephone numbers are not automatically validated because formats vary a lot across the world.

Validation for a specific format can be implemented with the pattern attribute.

If the browser does not support telephone input fields, it will fall back to a regular text field.


Syntax

<input type="tel">

Browser support

Here is when type="tel" support started for each browser:

Chrome
1.0 Sep 2008
Firefox
1.0 Sep 2002
IE/Edge
10.0 Sep 2012
Opera
11.0 Dec 2010
Safari
1.0 Jan 2003

You may also like

 Back to <input>

Author: Jack Poorte
Published: Jun 20 2021
Last Reviewed: Sep 30 2023


What's your favorite/least favorite part of Dofactory?


Guides