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.
An <input> element of type tel.
This field accepts telephone numbers that match a pattern. An example is 333-444-5555.
<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>
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.
<input type="tel">
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 |
Back to <input>