Parsley.js-在指定的元素中显示错误 [英] Parsley.js - Displaying Errors in a Specified Element
本文介绍了Parsley.js-在指定的元素中显示错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用 Parsley.js ,是否可以指定应该包含错误消息的元素?我试过了:
Using Parsley.js, is it possible to specify the element that should hold the error messages? I tried:
$('#myForm').parsley({
errors: {
container: {
$('#errorMessages')
}
}
});
但是错误消息仍然放置在我的表单输入之后.
But the error messages are still placed right after my form inputs.
推荐答案
我添加了另一个数据属性data-parsley-errors-container =#element",该属性可以让您直接在dom中指定错误的位置消息将必须显示.
I've added another data- attribute, data-parsley-errors-container="#element" that could allow you directly in dom to specify where the error messages will have to be displayed.
此处的更多信息: http://parsleyjs.org/doc/index.html#ui-for场
最佳
这篇关于Parsley.js-在指定的元素中显示错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文