Textbox accept only numbers (digits) using jquery

Textbox accept only numbers (digits) using jquery

HTML

Number : <input type="text" name="priceChange" id="priceChange" />&nbsp;<span id="errmsg"></span>

CSS

#errmsg
{
color: red;
}

.errrorInput
{
border: 1px solid red;
}

JavaScript

$(document).ready(function () {
  //called when key is pressed in textbox
  $("#priceChange").keypress(function (e) {
     //if the letter is not digit then display error and don't type anything
     if (e.which != 46 && e.which >31 && (e.which < 48 || e.which > 57)) {
        //display error message
        $("#errmsg").html("Digits Only").show().fadeOut("slow");
         $(this).addClass('errrorInput');
               return false;
     }else{
         $(this).removeClass('errrorInput');
     }
         
   });
});