Skip to content

Instantly share code, notes, and snippets.

@phsacramento
Created February 2, 2018 21:03
Show Gist options
  • Select an option

  • Save phsacramento/4ed8a816371e0d33e1e7da03a10fff83 to your computer and use it in GitHub Desktop.

Select an option

Save phsacramento/4ed8a816371e0d33e1e7da03a10fff83 to your computer and use it in GitHub Desktop.

Revisions

  1. phsacramento created this gist Feb 2, 2018.
    22 changes: 22 additions & 0 deletions javascript.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,22 @@
    var formatForm = function(){
    var that = this;
    this.$form = $('form');

    this.startup = function(){
    if(!this.$form[0]){ return false; }

    this.$form.find('input.tel').mask("(99) 9?9999-9999");
    this.$form.find('input.cep').mask("99999-999");
    this.$form.find('input.cpf').mask("999.999.999-99");
    this.$form.find('input.cnpj').mask("99.999.999/9999-99");
    this.$form.find('input.hour').mask("99:99");
    this.$form.find('input.date').mask("99/99/9999");
    this.$form.find('.datepicker').datepicker();
    }

    this.startup();
    }

    jQuery(document).ready(function($) {
    new formatForm();
    });