Hello,
Could someone tell me what going wrong with this code?
- $("#P_Profil").on("change", "#Inp_Taille", function ()
- {
- G_Taille = parseInt($("#Inp_Taille").val());
- var regT = new RegExp("^[1-2]{1}(\d){0,2}$|^[1-2]{1}[,.](\d){2}$");
- var ResultTestT = regT.test(G_Taille);
- if (ResultTestT)
- {
- console.log("On y passe");
- flgT = true;
- CalculIMC();
- CalculPoidsIdeal();
- $("#Inp_Taille").css("background-color", "rgba(255, 255, 255, 0.0)");
- } else
- {
- flgT = false;
- console.log("#Inp_Taille " + G_Taille);
- console.log("On y passe pas");
- $("#Inp_Taille").css("background-color", "#8a5757");
- }
- });
I'm sure my regEx is correct. It should accept a size expressed in centimeter or meter ex: 1,95 or 1.95 or 195 but the result of test() remains always 'false' . ???
Thanks in advance