Jquery Validation Not Getting Options
I'm trying to customise my form validation with no success. Nor message nor custom error class is firing when I test. Still, it seems to work, since it shows the standard error mes
Solution 1:
The rules
object can only be constructed using the name
attribute. In your case, the name
is contact_email
, not email
...
rules: {
contact_email: {
email: true
}
},
messages: {
contact_email: {
email: 'Please enter a valid email format: name@domain'
}
},
DEMO: http://jsfiddle.net/ov8zx694/2/
Also, the CSS is not working because you don't have any markup that contains the control-group
class.
$(element).closest('.control-group').addClass(errorClass);
Either change the markup so that it contains this class or change the class name to something that's already in your markup...
$(element).closest('.form-group').addClass(errorClass);
DEMO 2: http://jsfiddle.net/ov8zx694/3/
Post a Comment for "Jquery Validation Not Getting Options"