All Type Coding

Search Here

Numeric validation in javascript


function isNumber(e) {
            var keynum;

            keynum = e.keyCode ? e.keyCode : e.which;
            if ((keynum > 47 && keynum < 58) || keynum == 98) {

                return true;
            }
            else {
                e.preventDefault();
                alert('Please enter only numbers.');
                return false;
            }


        }

No comments :

Post a Comment