Answers for "jquery validation to accept only number with 10 digit"

2

jquery only number allowed to 10 digit

<script type="text/javascript">
  $(document).ready(function() {	
  $("#phone_work").attr("maxlength", "10");
  $("#phone_work").keypress(function(e) {
    var kk = e.which;
    if(kk < 48 || kk > 57)
      e.preventDefault();
  });
});
</script>
Posted by: Guest on October-09-2020
2

only numeric values are allow in input jquery

//allow a number in textbox using jQuery.
jQuery('.numbersOnly').keyup(function () { 
    this.value = this.value.replace(/[^0-9\.]/g,'');
});
Posted by: Guest on September-09-2021

Code answers related to "jquery validation to accept only number with 10 digit"

Code answers related to "Javascript"

Browse Popular Code Answers by Language