在jQuery验证中使用自定义CSS? [英] Using custom CSS with jQuery validation?
本文介绍了在jQuery验证中使用自定义CSS?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何将自定义CSS类用于错误消息? 我宁愿不为标准label.error设置样式.我想使用已有的CSS类.
How can I use a custom CSS class for the error messages? I'd rather not style the standard label.error. I want to use a CSS class I already have.
推荐答案
jQuery验证称为errorClass
:
使用此类创建错误标签,以查找现有错误 标签并将其添加到无效元素中.
Use this class to create error labels, to look for existing error labels and to add it to invalid elements.
您需要做的就是在原始$.validate
调用中指定它:
All you need to do is specify it in your original $.validate
call:
$('#myForm').validate({
errorClass:'myClass'
//your options
});
这篇关于在jQuery验证中使用自定义CSS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文