I have one text box, which I want to check for min-length, but it should check only when some text is there.
If someone has left that textbox empty, then it should not check for min-length.
Any suggestions?
If you mean, that the text box can be left empty, then this may be your answer:
$("#your_text_box").rules("add", {
required: false, // this means the field can be left empty
minlength: 2
});
Using this, validator will skip this text box if it is empty. Hope this helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With