JQuery validation based on class?

Posted by Mark Kadlec on Stack Overflow See other posts from Stack Overflow or by Mark Kadlec
Published on 2010-08-03T15:59:27Z Indexed on 2010/12/25 0:54 UTC
Read the original article Hit count: 144

I have a form that will have dynamically created elements, one of those will be of date type. There can also be many fields of this type on my form, all which must be validated.

I am using a strongly typed view in Asp MVC, so the name will change based on various factors. What I would like to do is validate based on a class name instead, since that will be constant for that type of field.

Ie:

<%= Html.TextBox("questionAnswers[" + index + "].AnswerValue", qa.AnswerValue, new { @class = "DateTypeClass" })%> 

So then I would need JQuery validation based on the classname DateTypeClass versus the Name.

Any ideas?

© Stack Overflow or respective owner

Related posts about asp.net-mvc-2

Related posts about jquery-plugins