[jQuery] Validate Plugin
[jQuery] Validate Plugin
Hi All,
I just started working with the validate plug in and I am having a
interesting problem. I am validating input text tag that is the
second column in a four column table. The error message is being
displayed in the third column. The txtCC2 is the problem at this
point.
Here is my code.
Thanks.
var validator = $("#form2").validate(
{
rules: {
txtCC2:{
required:true,
minlength:3
},
chkTerms: "required",
},
messages: {
txtCC2: {
required: "CC Validation Code Must Be Entered",
minlength: "CC Validation Code Must be 3 or 4
characters long."
},
chkTerms: "You must agree to terms and conditions before
checking out."
},
errorPlacement: function(error, element)
{
if ( element.is(":radio") )
error.appendTo( element.parent().next().next() );
else if ( element.is(":checkbox") )
error.appendTo ( element.next() );
else
error.appendTo( element.parent().next() );
}
})