Press "Enter" to skip to content

HTML Code for Phone Number Input Field Format | input-mask.js

Input mask is a small JavaScript library that automatically formats input values such as phone numbers and zip codes as you type.

auto format phone number input field, phone number field format, html code for phone number format, phone number field validation, phone number input masking

How to make use of it:

1. Download and embrace the input-mask.js JS library on the web page.

<script src=”./js/input-mask.js”></script>

2. Define your individual format sample within the data-pattern attribute.

<input class="masked" 
       type="tel" 
       data-pattern="+*(***)***-**-**" 
       placeholder="+1(234)567-89-10">

3. Add a prefix to the formatted value.

<input class="masked prefixed" 
       type="tel" 
       data-pattern="+**(***) *(**)-**-**" 
       data-prefix="+99(888)" 
       placeholder="+99(888) 1(23)-45-67" />

Real-time Input Field Formatting, vanilla js input mask Plugin/Github, phone number pattern in html


See Demo And Download

Official Website(AlexZaw): Click Here

This superior jQuery/javascript plugin is developed by AlexZaw. For extra advanced usage, please go to the official website.

Be First to Comment

    Leave a Reply

    Your email address will not be published.