Hello, I need to make my <input id="data">
as parameters:
taking into account the format of: 00/00/000;
the first two from 0 to 31. (if they put value above, it resets to 31)
The third: 0 or 1;
The fourth number: 0 to 12;
and the fifth and sixth only: 19 or 20; the seventh and the eighth free numbers from 0 to 9;
// ADICIONANDO METHOD DE DATA NO VALIDATION
$.validator.addMethod("data",function(value, element) {
value = jQuery.trim(value);
var a = value;
var b = a.charAt(0); // aqui eu ACREDITO ter selecionado o primeiro numero
return value.match(/^\d\d?\d\d\/\d\d\d\d$/);
return this.optional(element) || retorno;
},
"Por favor, informe uma data válida"
);
The bars are already inserted in the mask that I created: jQuery (function ($) {
$("#data").mask("99/99/9999");
$("#fone").mask("(99) 9999-9999");
$("#cpf").mask("999.999.999-99");
$("#cep").mask("99.999-999");
});
JSFiddle this using jquery. :)