Input Only Digit Script


$(document).ready(function (){
//called when key is pressed in textbox
$(“#FieldID”).keypress(function (e) {
//if the letter is not digit then display error and don’t type anything
if (e.which != 8 && e.which != 0 && (e.which < 48 || e.which > 57)) {
//display error message
$(“#errmsgID”).html(“Digits Only”).show().fadeOut(“slow”);
return false;



.errmsg{color: red;}

Html Code

<div class=”form-group”>
<label class=”control-label col-sm-3″ id=”routingNumberlabel”>Routing Number *</label>
<div class=”col-sm-2″>
<input class=”form-control echeckInput” type=”text” id=”FieldID” name=”x_routingNumber” size=”9″ maxlength=”9″ />
&nbsp;<span class=”errmsg” id=”errmsgID”></span>


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s