So I have the following code in jQuery, and I am trying to essentially match dates in the format MM/YYYY where MM is a value between 1 and 12 and YYYY is a date in 1900s or 2000s. I haven't really used the jQuery test function before. Can someone tell me whats wrong with my code or the Regex?
var fieldValue = $(this).val();
if(!fieldValue.test(([1-9]|1[0-2])/^(19|20)\d\d)){
Errors = Errors + 1;
$(this).addClass("form_error");
}
Aucun commentaire:
Enregistrer un commentaire