How to Create a Telephone Input Field in HTML5
Though field validation and data formatting are the biggest challenges of working with web browsers, HTML5 does some help in enforcing this for us. Telephone input field can be created using type=”tel”: <input type="tel" name="phone_num" id="phone_num"/> This looks like every other input field, with the difference that it optimizes the keyboard. Certain platforms like tablets, or smartphones will pop-up only-numeric keyboard for this input field. It is hard to enforce particular regular expression through HTML because of variety of phone number formats used along with differences in country codes, and number separators.