How To Validate Phone Number Using Jquery Input Mask

How To Validate Phone Number Using Jquery Input Mask

In this small tutorial I will explain you how to validate phone number using jquery input mask, Using jquery input mask we can validate diffrent type of phone no with diffrent country code. Here, we are using jquery inputmask js for this example...

In this small tutorial I will explain you how to validate phone number using jquery input mask, Using jquery input mask we can validate diffrent type of phone no with diffrent country code. Here, we are using jquery inputmask js for this example, so we can easily validate phone no.

This Article is Originally Published on Websolutionstuff : https://websolutionstuff.com/post/how-to-validate-phone-number-using-jquery-input-mask

<html>
<head>
    <title>jquery input mask phone number validation - websolutionstuff</title>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.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" style="border:1px solid red; padding: 0px 20px 20px 20px; margin-top: 20px;">
    <h1>jquery input mask phone number validation - websolutionstuff.com</h1>
      <br>
    <strong>Phone Number:</strong>  
    <input type="text" name="phone" class="phone_number form-control" value="9876543210">
      <br>
    <strong>Phone Number:</strong>  
    <input type="text" name="phone" class="phone_number_2 form-control" value="9876543210">
      <br>
    <strong>Phone Number:</strong>  
    <input type="text" name="phone" class="phone_number_3 form-control" value="91 9876543210">

</div>

<script>
    $(document).ready(function(){
        $('.phone_number').inputmask('(999)-999-9999');
        $('.phone_number_2').inputmask('(99)-9999-9999');
        $('.phone_number_3').inputmask('+99-9999999999');
    });
</script>

</body>
</html>

In above code i have added inputmask in jquery for diffrent validation.

You can see output in below screen print.

How To Validate Phone Number Using Jquery Input Mask


Also Read : Google Map With Draggable Marker Example

javascript jquery validation phone number input-mask

What is Geek Coin

What is GeekCash, Geek Token

Best Visual Studio Code Themes of 2021

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

How to validate mobile phone number in laravel with example

Data validation is a very important thing for a web application. In this article i will let you know how to validate mobile phone number in laravel.

How To Validate Password And Confirm Password Using JQuery

how to validate password and confirm password using jQuery, validation in php, how to validate password in jquery, validate password and confirm password in jquery, password and confirm password validation using jquery, how to check password and confirm password in jquery validation, validation for password and confirm password in jquery,

Dynamically Add/Remove Multiple input Fields and Submit to DB with jQuery and Laravel

In this tutorial, we will sho you how to dynamically add/remove multiple input fields and submit to database with jquery and laravel

How to Validate Phone Number Input in HTML and JavaScript

Learn how to use two free tools to check a phone number's validity using HTML and JavaScript. This post will walk through two ways to check a phone number's validity: the Twilio Lookup API and the intl-tel-input JavaScript plugin. This builds on How to build international phone number input in HTML and JavaScript, which you can reference for more details on building the nice-looking phone number input field I'm using below.

JavaScript vs jQuery — Learn DOM manipulation without using jQuery

With improvements in browser standards and most of jQuery’s API’s integrated into JavaScript, jQuery has become a little redundant. Learn DOM manipulation without using jQuery