A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.geeksforgeeks.org/html/html-input-typetel/ below:

HTML <input type="tel"> - GeeksforGeeks

HTML <input type="tel">

Last Updated : 20 May, 2024

The HTML <input type="tel"> element creates a telephone number input field, specifically designed for entering phone numbers. It provides features like input validation for telephone numbers and may include special characters like parentheses and hyphens for formatting. This element helps ensure that users enter phone numbers correctly in web forms.

Syntax
<input type="tel"> 

Example: This example demonstrates the use of HTML <input type="tel"> element.

HTML
<!DOCTYPE html>
<html>

<head>
    <title>HTML Input Type Tel</title>
</head>

<body style="text-align:center;">
    <h2>HTML &lt;input type="tel"&gt;</h2>

    <form action="#">
        <label for="contact">Phone No:</label>
        <input type="tel" id="contact" 
            pattern="[0-9]{3}-[0-9]{3}-[0-9]{4}" 
            required />

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

</html>

Output

Supported Browsers

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4