Pages

Jquery Numbers Only Text Box

Jquery Numbers Only Text Box

Jquery Numbers Only Text Box


HTML Code for number only typed text box

<input class="login"  type="text" onkeypress="return isNumber(event)" name="reserve" id="reserve" />

JQuery Code

<script>
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;
}
</script>

No comments:

Post a Comment

Search This Blog