Notes
HTML
CSS
JS
Tools
Code Snippets
HTML Entity
About
Contact Us
How to use jQuery Input Mask to Validate Phone Number
HTML
CSS
JS
Output
HTML
<!DOCTYPE html> <html> <head> <title>How to use jQuery Input Mask to Validate Phone Number</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.4.0/css/bootstrap.min.css" /> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.inputmask/3.3.4/jquery.inputmask.bundle.min.js"></script> </head> <body> <div class="container main-div"> <div> <h1 class="rangeSliderHeading">How to use jQuery Input mask to validate Phone Number</h1> <strong>Phone Number Example 1</strong> <input type="text" name="phone" class="phone-input-div-1 form-control"> <strong>Phone Number Example 2</strong> <input type="text" name="phone" class="phone-input-div-2 form-control"> <strong>Phone Number Example 3</strong> <input type="text" name="phone" class="phone-input-div-3 form-control"> </div> </div> </body> </html>
Copied
<!DOCTYPE html> <html> <head> <title>How to use jQuery Input Mask to Validate Phone Number</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.4.0/css/bootstrap.min.css" /> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.inputmask/3.3.4/jquery.inputmask.bundle.min.js"></script> </head> <body> <div class="container main-div"> <div> <h1 class="rangeSliderHeading">How to use jQuery Input mask to validate Phone Number</h1> <strong>Phone Number Example 1</strong> <input type="text" name="phone" class="phone-input-div-1 form-control"> <strong>Phone Number Example 2</strong> <input type="text" name="phone" class="phone-input-div-2 form-control"> <strong>Phone Number Example 3</strong> <input type="text" name="phone" class="phone-input-div-3 form-control"> </div> </div> </body> </html>
CSS
.rangeSliderHeading { color: rgb(6, 2, 114); text-align:center; } .main-div { display: flex; flex-direction: column; justify-content: center; align-items: center; height: 100vh; }
Copied
.rangeSliderHeading { color: rgb(6, 2, 114); text-align:center; } .main-div { display: flex; flex-direction: column; justify-content: center; align-items: center; height: 100vh; }
JS
$(document).ready(function () { $('.phone-input-div-1').inputmask('(999)-999-9999'); $('.phone-input-div-2').inputmask('(99)-9999-9999'); $('.phone-input-div-3').inputmask('99-9999999-999'); });
Copied
$(document).ready(function () { $('.phone-input-div-1').inputmask('(999)-999-9999'); $('.phone-input-div-2').inputmask('(99)-9999-9999'); $('.phone-input-div-3').inputmask('99-9999999-999'); });
Output
Our Courses
HTML 5
CSS
JavaScript
MySql
PHP
Laravel
Bootstrap
Programming Tutorial
PHP
JavaScript
HTML
Laravel
MySQL
JQuery
CSS
Git
Bootstrap
Vue JS
Android
Python
Server
Code Snippets
Chat Box
Range Slider
Radio Button
Select Box
Nav Bar
Other
Testimonial
Carousel
Logo
Loader
Lightbox
Forms
Popup
Table
HTML Course Code
HTML Entity
↑→ Arrows
$¢ Currency
Aö Letters
%+ Math
1¾ Numbers
&— Punctuation
©™ Symbols
Best Of
Internet
Technology
Health
Travel
Onine Tools
CSS Minifier
Text Converter
Age Calculator
Pincode Details
Whiteboard
PDF to Text
Gradient Generator
PX to REM Converter
REM to PX Converter
PX to EM Converter
EM to PX Converter
WEBP Converter
Latest & Upcoming movies
Bollywood
Hollywood
Tamil
Telgu
Bangla
Web Series
Notes
HTML
CSS
JS