Answers for "jquery accept only numbers"

1

only numeric values are allow in input jquery

//allow a number in textbox using jQuery.
$('#valuepoints').keypress(function (e) {    
  var charCode = (e.which) ? e.which : event.keyCode;
  if (String.fromCharCode(charCode).match(/[^0-9]/g))
    return false;
});
Posted by: Guest on September-09-2021
1

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 accept only numbers"

Code answers related to "Javascript"

Browse Popular Code Answers by Language