2011-05-11 112 views
6

我想改变jQuery验证适用于有一个错误是否有可能更改jQuery验证的错误类名称?

更改此

<input id="firstname" name="firstname" type="text" value="" maxlength="100" 
class="error"> 

此输入该类

<input id="firstname" name="firstname" type="text" value="" maxlength="100" 
class="customErrorClass"> 

回答

24

尝试指定errorClass属性:

$('.selector').validate({ 
    errorClass: 'customErrorClass', 
    rules: { ... }, 
    messages: { ... } 
}); 
+0

像冠军一样工作,谢谢。这不是[this](http://docs.jquery.com/Plugins/validation)页面。 – guanome 2011-05-11 14:16:21

+0

@guanome,不,但它在[this one]上(http://docs.jquery.com/Plugins/Validation/validate#options)。 – 2011-05-11 14:17:03

+0

感谢它工作正常... – Karthik 2013-03-14 13:29:08