I am using jquery validation plugin for validation. I am using one javascript function for many forms so it is difficult to define rules for all fields for many forms.
What is the code if I want to apply a rule "required=true" for all textfields those have a class "required".
I am trying this but it is applying this rule only on first field. Remember I want to show images instead of error text message when a field in not validated.
$(obj).find("input.required").rules("add", {
required: true,
minlength: 2,
messages: {
required : "<img id='exclamation' src='images/exclamation.gif' title='This field is required.' />",
minlength: "<img id='exclamation' src='images/exclamation.gif' title='At least 2 characters.' />"
}
});