I have an input box need to restrict alphabets in keyup function.
I used ASCII value to prevent them.
$('.numbers').keyup(function(e) {
  if (((e.which > 47) && (e.which <
      58)) || (e.which == 46) || (e.which == 8)) {
    console.log("success");
  } else {
    return false;
  }
});<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<input id="height" class="numbers" value="172" type="text" name="height">
<input id="weight" type="text" class="numbers" value="55" name="weight">I need to Restrict the alphabets in my input box.
 
    