i need to void dot(.) form user key press is not working

This is my jquery it is avoid all the symbols and alphabet but it allow a dot (.) i don't know why someone help me please. . .

 $('.Number').keypress(function (event) {
    var keycode;

    keycode = event.keyCode ? event.keyCode : event.which;

    if (!(event.shiftKey == false && (keycode == 46 || keycode == 27 || keycode == 9 || keycode == 8 || keycode == 37 || keycode == 39 || (keycode >= 48 && keycode <= 57)))) {

        return false;
    else {

        return true;


You would have better to use a regex for that kind of check:

DEMO jsFiddle

$('.Number').keypress(function (event) {
    if(!/\d/.test(String.fromCharCode(event.which))) return false;

According to: http://www.cambiaresearch.com/articles/15/javascript-char-codes-key-codes the correct keycode for . (period) is 190 (or 110), and you have not added this to your list.

Note that browser implementations (and thus results) may vary and I have no idea the effect of regional keyboard settings on these keycodes.

Because you haven't added the keycode for decimal point.

110 for . for full stop 190 for decimal point

Need Your Help

How to use function added with class decorator

typescript decorator

I have created a class decorator that all it does is add a function to the prototype of a class

GetFileAttributes in NTFS


i want to use a windows API to check a file/directory is hidden or not .