1
Hi, I need to make mine <input id="data">
has as parameters:
taking into account the format of : 00/00/000;
the first two from 0 to 31. (if you 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 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 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. :)
and you want the bars to be inserted by the user or the mask?
– Sergio
The bars are already inserted by the mask, I only need the control of the value that is inserted
– manzetti.denis
http://jsfiddle.net/9juy4m5j/
– manzetti.denis
the main purpose is to create a mask or validate the date or both? If you want to validate, you can try this plugin: http://jqueryvalidation.org/date-method/
– Daniel Omine
the purpose and make the user not able to put a value above 31 in the first 2 characters and so on, is explained above.
– manzetti.denis