JSFiddle - React, Tailwind, and code Playground

by Algrain Patrick

HTML

<div data-role="page" id="P_Profil">
  <div data-role="content">
    <input type="number" id="Inp_Taille">
  </div>
</div>

JavaScript

$("#P_Profil").on("change", "#Inp_Taille", function() {
  G_Taille = $("#Inp_Taille").val();
  var reg = new RegExp("^[1-2]{1}(\d){0,2}$|^[1-2]{1}[,.](\d){2}$");
  var ResultTestT = reg.test(G_Taille);
  alert("Test " + ResultTestT);
  console.log("regT " + reg);
  if (ResultTestT) {
    alert("On y passe");
    flgT = true;
    $("#Inp_Taille").css("background-color", "rgba(255, 255, 255, 0.0)");
  } else {
    flgT = false;
    alert("#Inp_Taille " + G_Taille);
    alert("On y passe pas");
    $("#Inp_Taille").css("background-color", "#8a5757");
  }
});