Sunday, March 31, 2019

Allow Number to insert into text box

function isNumber(evt) {
    evt = (evt) ? evt : window.event;
    var charCode = (evt.which) ? evt.which : evt.keyCode;
    if (charCode > 31 && (charCode < 48 || charCode > 57)) {
        return false;
    }
    return true;
}

onkeypress="return isNumber(event)"

No comments:

Post a Comment