TOC

The community is working on translating this tutorial into Hindi, but it seems that no one has started the translation process for this article yet. If you can help us, then please click "More info".

Form validation using HTML5:

Validating phone numbers

As of writing this, this is one of the new input types that are not yet supported by any browsers. This means, that the browsers do not check for any patterns as with the url or email input. One of the reasons this input type have no pattern might be the fact that phonenumbers differs from country to country and therefore prevents the use of one standard pattern. This should not prevent you from using this input type as it makes your markup more semantically correct and future-proofs your website.

<form>
	Your phonenumber: <input type="tel" required />
	<input type="submit" value="Submit now" />
</form>

One of the other great things about this input type is, that most smartphones changes the keyboard from the regular qwerty keyboard to a number pad – and this really improves the user experience!


This article has been fully translated into the following languages: Is your preferred language not on the list? Click here to help us translate this article into your language!
adplus-dvertising