Monday, July 6, 2020

Number Validation with fixed count using jQuery




      <div class="row">
        <div class="col-md-6 offset-md-3">
          <input type="textclass="form-control"
 placeholder="Enter Contact No. Only
name="phoneid="phoneautocomplete="offrequired>
        </div>
      </div>


<script type="text/javascript">
      $("input[name=phone]").attr("maxlength", "10");
      $('#phone').keypress(function(e) {
        //if the letter is not digit then display
 error and don't type anything
        if (e.which != 8 && e.which != 0 && 
(e.which < 48 || e.which > 57)) {
          //display error message
          //$("#errmsg").html("Digits Only").show().
fadeOut("slow");
          return false;
        }

      });
</script>


Code run perfectly.

Any issue contact me

No comments:

Post a Comment

colourful pyramid using PHP

  <! DOCTYPE html > < html lang = "en" > < head >   < title >Colorfull Pyramid</ title >   < me...

Clock