how do i use the jquery validation plugin to conditional validate
I am using the bassistance jQuery plugin validation.
I have a drop down list with 2 values.
If the first value is selected by the user a valid date field needs to be populated and if the second option is selected then a textbox needs to be filled with some text.
If nothing is selected then it need to return a validation on this as w开发者_开发知识库ell
How can I achieve this?
thanks
Well, if it is a dropdown, you can't really have "nothing" selected. So, it sounds like in your case, you might want to make three options, the first of which is something like "Choose one", you can then you the jQuery to test for this condition and throw an alert if that value isn't one of the two that trigger an action. You can then force them to go back and choose of the two other options.
精彩评论