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:
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?Code:<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>
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....



Reply With Quote




Bookmarks