only numeric values are allow in input jquery

Solutions on MaxInterview for only numeric values are allow in input jquery by the best coders in the world

showing results for - "only numeric values are allow in input jquery"
Klara
14 Jul 2017
1//allow a number in textbox using jQuery.
2$('#valuepoints').keypress(function (e) {    
3  var charCode = (e.which) ? e.which : event.keyCode;
4  if (String.fromCharCode(charCode).match(/[^0-9]/g))
5    return false;
6});   
Kais
24 May 2019
1//allow a number in textbox using jQuery.
2jQuery('.numbersOnly').keyup(function () { 
3    this.value = this.value.replace(/[^0-9\.]/g,'');
4});