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

Front-End Custom Development

  Front-End Custom Development Our front-end functional components are tailor-made, crafted from the ground up to provide not only exception...

Clock