集中来自表单的一些错误消息
目前,我正在使用errorPlacement
为每个输入打印错误消息:
$('#my_form').validate({ errorPlacement: function(error, element) { // Some code that print error below each inputs }, ...
然后,我尝试使用showErrors
集中错误消息,如下所示:
showErrors: function(errorMap, errorList) { // Some code that centralize each error for each input in one place }, ... });
它工作正常,但现在我只想集中我的表单的一些错误消息 ,而不是所有的错误消息 。 比如将showErrors
仅用于我想要集中的输入,然后使用errorPlacement
用于其他输入。
比如将
showErrors
仅用于我想要集中的输入,然后使用errorPlacement
用于其他输入。
一个人总会骑过另一个人。
您必须对所有内容使用showErrors
,您可以在其中检查errorMap
和errorMap
,并有条件地将每条消息放在您需要的位置。
你可以使用text-align:center; css中的财产。