Making conditions in jquery validator

JQuery Validate plugin is a good thing to control web-forms. I have learnt about it, but I want to make something extra.

Suppose, I have a <select> tag with a few options. If a user selects a specific one, another input field gets added and it’s required on that circumstance.

But, I want to do, that field will only be required if the specific option is selected.

For example:

<select id="any" name="any">
  <options>1</options>
  <options>2</options> <!-- make it specific -->
  <options>3</options>
</select>
<div id="hidden_f">
  <label for="any" id="any">Type</label>
  <input type="text" id="any" name="any">
</div> 

If the user selects ‘2’ in selection, the hidden field is shown and it’s required. Otherwise, if the user didn’t select ‘2’, the field will not be shown and it’s not required. How to accomplish such condition?

I have read the JQUERY Validate Doc, but it’s not so friendly for newbies. So I think you can explain me a lot.
Thanks in advance…

When the form requirements change, you would need to remove the older validation rules and create a new set of validation rules that apply to the new form setup.

Ok. But how? I am new and can’t understand. Again, my whole form requirements doesn’t change, it only applies to one field.

It should be possible then to add and/or remove certain rules for the validation then. Let’s see if that is possible with the validation plugin.

And yes, it does indeed seem that there are methods to add and remove rules. If you go to the plugin methods section you will see them there. The [url=“http://docs.jquery.com/Plugins/Validation/rules#rules.28.C2.A0.22add.22.2C.C2.A0rules_.29”]add rules and [url=“rules.28.C2.A0.22remove.22.2C.C2.A0.5Brules.5D_.29”]remove rules methods.

Many many thanks. I didn’t read that thing. But now it’s clear