Logo
jquery-mask-plugin is a jQuery plugin which create an input mask. An input mask helps the user with the input by ensuring a predefined format.This can be useful for dates, numerics, phone numbers, etc.
For more info please visit the plugin's Demo Pageor Github Repo.

JQuery Mask Examples


                            <div class="card card-custom example example-compact">
                                <div class="card-header">
                                    <h3 class="card-title">
                                        JQuery Mask Examples
                                    </h3>
                                    <div class="card-toolbar">
                                        <div class="example-tools justify-content-center">
                                            <span class="example-toggle" data-toggle="tooltip" title="View code"></span>
                                        </div>
                                    </div>
                                </div>
                                <!--begin::Form-->
                                <form class="form">
                                    <div class="card-body">
                                        <div class="form-group row">
                                            <label class="col-form-label text-right col-lg-3 col-sm-12">Date</label>
                                            <div class="col-lg-6 col-md-9 col-sm-12">
                                                    <input type="text" class="form-control date" id="kt_date_input"/>
                                                <span class="form-text text-muted">Custom date format: <code>mm/dd/yyyy</code></span>
                                            </div>
                                        </div>
                                        <div class="form-group row">
                                            <label class="col-form-label text-right col-lg-3 col-sm-12">Hour</label>
                                            <div class="col-lg-6 col-md-9 col-sm-12">
                                                <input type="text" class="form-control time" id="kt_time_input"/>
                                                <span class="form-text text-muted">Custom time format: <code>hh:mm:ss</code></span>
                                            </div>
                                        </div>
                                        <div class="form-group row">
                                            <label class="col-form-label text-right col-lg-3 col-sm-12">Date & Hour</label>
                                            <div class="col-lg-6 col-md-9 col-sm-12">
                                                <input type="text" class="form-control date_time" id="kt_date_time_input"/>
                                                <span class="form-text text-muted">Custom date & time format: <code>mm/dd/yyyy hh:mm:ss</code></span>
                                            </div>
                                        </div>
                                        <div class="form-group row">
                                            <label class="col-form-label text-right col-lg-3 col-sm-12">ZIP Code</label>
                                            <div class="col-lg-6 col-md-9 col-sm-12">
                                                <input type="text" class="form-control cep" id="kt_cep_input"/>
                                                <span class="form-text text-muted">Zip code mask: <code>99999-999</code></span>
                                            </div>
                                        </div>
                                        <div class="form-group row">
                                            <label class="col-form-label text-right col-lg-3 col-sm-12">Telephone</label>
                                            <div class="col-lg-6 col-md-9 col-sm-12">
                                                <input type="text" class="form-control phone" id="kt_phone_input"/>
                                                <span class="form-text text-muted">Telephone mask: <code>9999-9999</code></span>
                                            </div>
                                        </div>
                                        <div class="form-group row">
                                            <label class="col-form-label text-right col-lg-3 col-sm-12">Telephone with Code Area</label>
                                            <div class="col-lg-6 col-md-9 col-sm-12">
                                                <input type="text" class="form-control phone_with_ddd" id="kt_phone_with_ddd_input"/>
                                                <span class="form-text text-muted">Telephone with Code Area mask: <code>(99) 9999-9999</code></span>
                                            </div>
                                        </div>
                                        <div class="form-group row">
                                            <label class="col-form-label text-right col-lg-3 col-sm-12">CPF</label>
                                            <div class="col-lg-6 col-md-9 col-sm-12">
                                                <input type="text" class="form-control cpf" id="kt_cpf_input"/>
                                                <span class="form-text text-muted">CPF format: <code>999.999.999-99</code></span>
                                            </div>
                                        </div>
                                        <div class="form-group row">
                                            <label class="col-form-label text-right col-lg-3 col-sm-12">CNPJ</label>
                                            <div class="col-lg-6 col-md-9 col-sm-12">
                                                <input type="text" class="form-control cnpj" id="kt_cnpj_input"/>
                                                <span class="form-text text-muted">CNPJ format: <code>99.999.999/9999-99</code></span>
                                            </div>
                                        </div>
                                        <div class="form-group row">
                                            <label class="col-form-label text-right col-lg-3 col-sm-12">Money</label>
                                            <div class="col-lg-6 col-md-9 col-sm-12">
                                                <input type="text" class="form-control money" id="kt_money_input"/>
                                                <span class="form-text text-muted">Money format: <code>999.999.999.999.999,99</code></span>
                                            </div>
                                        </div>
                                        <div class="form-group row">
                                            <label class="col-form-label text-right col-lg-3 col-sm-12">Money 2</label>
                                            <div class="col-lg-6 col-md-9 col-sm-12">
                                                <input type="text" class="form-control money2" id="kt_money2_input"/>
                                                <span class="form-text text-muted">Money format: <code>_.__9,99</code></span>
                                            </div>
                                        </div>
                                        <div class="form-group row">
                                            <label class="col-form-label text-right col-lg-3 col-sm-12">Percent</label>
                                            <div class="col-lg-6 col-md-9 col-sm-12">
                                                <input type="text" class="form-control percent" id="kt_percent_input"/>
                                                <span class="form-text text-muted">Percent format: <code>__9,99%</code></span>
                                            </div>
                                        </div>
                                        <div class="form-group row">
                                            <label class="col-form-label text-right col-lg-3 col-sm-12">With Clear If Not Match Option</label>
                                            <div class="col-lg-6 col-md-9 col-sm-12">
                                                <input type="text" class="form-control clear-if-not-match" id="kt_clear_if_not_match_input"/>
                                                <span class="form-text text-muted">Date format: <code>mm/dd/yyyy</code></span>
                                            </div>
                                        </div>
                            
                            
                                    </div>
                                    <div class="card-footer">
                                        <div class="row">
                                            <div class="col-lg-9 ml-lg-auto">
                                                <button type="reset" class="btn btn-success mr-2">Submit</button>
                                                <button type="reset" class="btn btn-secondary">Cancel</button>
                                            </div>
                                        </div>
                                    </div>
                                </form>
                                <!--end::Form-->
                            </div>
      

                            "use strict";
                            // Class definition
                            
                            var KTMaskDemo = function () {
                            
                                // private functions
                                var demos = function () {
                                    $('#kt_date_input').mask('00/00/0000', {
                                        placeholder: "dd/mm/yyyy"
                                    });
                            
                                    $('#kt_time_input').mask('00:00:00', {
                                        placeholder: "hh:mm:ss"
                                    });
                            
                                    $('#kt_date_time_input').mask('00/00/0000 00:00:00', {
                                        placeholder: "dd/mm/yyyy hh:mm:ss"
                                    });
                            
                                    $('#kt_cep_input').mask('00000-000', {
                                        placeholder: "99999-999"
                                    });
                            
                                    $('#kt_phone_input').mask('0000-0000', {
                                        placeholder: "9999-9999"
                                    });
                            
                                    $('#kt_phone_with_ddd_input').mask('(00) 0000-0000', {
                                        placeholder: "(99) 9999-9999"
                                    });
                            
                                    $('#kt_cpf_input').mask('000.000.000-00', {
                                        reverse: true
                                    });
                            
                                    $('#kt_cnpj_input').mask('00.000.000/0000-00', {
                                        reverse: true
                                    });
                            
                                    $('#kt_money_input').mask('000.000.000.000.000,00', {
                                        reverse: true
                                    });
                            
                                    $('#kt_money2_input').mask("#.##0,00", {
                                        reverse: true
                                    });
                            
                                    $('#kt_percent_input').mask('##0,00%', {
                                        reverse: true
                                    });
                            
                                    $('#kt_clear_if_not_match_input').mask("00/00/0000", {
                                        clearIfNotMatch: true
                                    });
                                }
                            
                                return {
                                    // public functions
                                    init: function() {
                                        demos();
                                    }
                                };
                            }();
                            
                            jQuery(document).ready(function() {
                                KTMaskDemo.init();
                            });
      
Custom date format: mm/dd/yyyy
Custom time format: hh:mm:ss
Custom date & time format: mm/dd/yyyy hh:mm:ss
Zip code mask: 99999-999
Telephone mask: 9999-9999
Telephone with Code Area mask: (99) 9999-9999
CPF format: 999.999.999-99
CNPJ format: 99.999.999/9999-99
Money format: 999.999.999.999.999,99
Money format: _.__9,99
Percent format: __9,99%
Date format: mm/dd/yyyy

Notifications 24 New

Quick Actions finance & reports

User Profile 15 messages

Recent Notifications

Important Notice

Lorem Ipsum is simply dummy text of the printing and industry.

System Update

There are many variations of passages of Lorem Ipsum available.

Server Maintenance

Contrary to popular belief, Lorem Ipsum is not simply random text.

DB Migration

If you are going to use a passage of Lorem Ipsum, you need.

System Messages
09:30 AM

To start a blog, think of a topic about and first brainstorm ways to write details

2:45 PM

To start a blog, think of a topic about and first brainstorm ways to write details

3:12 PM

To start a blog, think of a topic about and first brainstorm ways to write details

7:05 PM

To start a blog, think of a topic about and first brainstorm ways to write details

Notifications
Pic
Marcus Smart UI/UX, Art Director
+65%
AH
Andreas Hawks Python Developer
+23%
SC
Sarah Connor HTML, CSS. jQuery
-34%
Pic
Amanda Harden UI/UX, Art Director
+72%
SR
Sean Robbins UI/UX, Art Director
+65%
JT
Jason Tatum ASP.NET Developer
+139%

Privacy Settings:

After you log in, you will be asked for additional information to confirm your identity.

Security Settings:

After you log in, you will be asked for additional information to confirm your identity. For extra security, this requires you to confirm your email. Learn more.

Select A Demo

Demo 1
Demo 2
Demo 3
Demo 4
Demo 5
Demo 6
Demo 7
Demo 8
Demo 9