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.
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?
<select id="any" name="any">
<options>2</options> <!-- make it specific -->
<label for="any" id="any">Type</label>
<input type="text" id="any" name="any">
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....