jQuery Validate plugin with metadata broken after upgrade to jQuery 2.0.0
I successfully used jQuery Validate plugin with metadata (this one at
http://bassistance.de/jquery-plugins/jquery-plugin-validation/ ).
versions:
- validate 1.9
- metadata * Revision: $Id: jquery.metadata.js 4187 2007-12-16 17:15:27Z joern.zaefferer
- jquery 1.7.2
I now upgraded jQuery to 2.0.0, validate to 1.11.1, can't find metadata anymore (404 here: https://github.com/jquery/jquery-metadata )
Part of my form:
- <input id="email_big" name="email" type="text" class="span4 {validate:{required:true, messages:{required:'my required message'}}}" />
Validation function:
- $("#login_form").validate({
meta: "validate",
validClass: "success",
onfocusout: false,
highlight: function(element, errorClass, validClass) {
$(element).parents('div.control-group').addClass(errorClass).removeClass(validClass);
},
unhighlight: function(element, errorClass, validClass) {
$(element).parents('div.control-group').addClass(validClass).removeClass(errorClass);
},
errorElement: 'span',
wrapper: 'span class="help-inline"',
submitHandler: function(form) {
form.submit();
}
});
Error returned by jQuery:
Error: Syntax error, unrecognized expression: span class="help-inline"
The documentation for the plugin doesn't mention metadata anymore, but I need it since I use it everywhere and having error messages printed directly in HTML allows me to easily translate them.
Removing the wrapper removes the error, but the validation seems to always return true
How can I fix it?