2011-05-11 111 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