clock  Mon - Sun 8.00 AM - 8.00 PM
mail  edu@teknowize.com
fb
instagram
play store
pinterest

How to Validate Phone Number using jQuery Input Mask Plugin

  Sumit Dey Sarkar
  11 Sep 2022
  JQuery
Imperial Advance Hero Image

How to Validate Phone Number using jQuery Input Mask Plugin

In this article we will learn how to validate phone number using jQuery input mask plugin.

Let's see example - 

 

How to Validate Phone Number using jQuery Input Mask Plugin

<!DOCTYPE html>
<html>
<head>
    <title>How to Validate Phone Number using jQuery Input Mask Plugin</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">
    <h1>How to Validate Phone Number using jQuery Input Mask Plugin</h1>
  
    <strong>Phone Number:</strong>  
    <input type="text" name="phone" class="inputDivArea form-control" value="9123456344">
  
    <strong>Phone Number 2:</strong>  
    <input type="text" name="phone" class="inputDivArea2 form-control">
  
    <strong>Phone Number 3:</strong>  
    <input type="text" name="phone" class="inputDivArea3 form-control">
  
</div>
  
<script>
    $(document).ready(function(){
        $('.inputDivArea').inputmask('(999)-999-9999');
        $('.inputDivArea2').inputmask('(99)-9999-9999');
        $('.inputDivArea3').inputmask('99-9999999-999');
    });
</script>
  
</body>
</html>

 

Output

jquery