views:

14

answers:

1

Hello All,

I am having the jquery.validate.js plugin and it is working fine for me.

My question is :

I am having a textbox and this textbox is mandatory and should only accept digits.

In the js, I can see that there is validation for the digits and the problem is that I do not know how to use it.

I only knew how to make the field required by putting in the textbox field <class="required">

So, how can I add one more validation criteria to accept only digits.

Thanx

A: 

to check it add

$("#myform").validate({
  rules: {
    amount: {
      required: true,
      digits: true
    }
  }
});

http://docs.jquery.com/Plugins/Validation/Methods/digits

Haim Evgi
Thank you my fried, but if i am using the validation in the jsp like <input type="text" name="amount" size="10" value="<%=amount%>" id="amount" class="required" minlength="1" maxlength="10"> How do I add the digits with them
maas
i update it , i put amount your name field in the code, work on your accept rate !!
Haim Evgi