Reputation: 23
<input type="tel" pattern="[7-9][0-9]{9}">
Please mention the attribute type. Thanks in advance.
Upvotes: 0
Views: 360
Reputation: 11
You can use any of the following
<input type="tel" pattern="(7|8|9)\d{9}" placeholder="(7|8|9)\d{9}">
<input type="tel" pattern="[789][0-9]{9}" placeholder="[789][0-9]{9}">
<input type="tel" pattern="[7-9][0-9]{9}" placeholder="[7-9][0-9]{9}">
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Tel Validation</title>
</head>
<body>
<form action="#">
<input type="tel" pattern="(7|8|9)\d{9}" placeholder="(7|8|9)\d{9}"> <br><br>
<input type="tel" pattern="[789][0-9]{9}" placeholder="[789][0-9]{9}"> <br><br>
<input type="tel" pattern="[7-9][0-9]{9}" placeholder="[7-9][0-9]{9}"> <br><br>
<input type="submit" value="Submit">
</form>
</body>
</html>
Upvotes: 1