本文介紹了Parsley.js - 在指定元素中顯示錯誤的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!
問題描述
使用 Parsley.js,是否可以指定應(yīng)該保存錯誤消息的元素?我試過了:
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.
推薦答案
我添加了另一個數(shù)據(jù)屬性,data-parsley-errors-container="#element"
.這可以讓您修改 DOM 以指定錯誤消息的顯示位置.
I've added another data-attribute, data-parsley-errors-container="#element"
.
That could allow you modify the DOM to specify where the error messages will be displayed.
更多信息:http://parsleyjs.org/doc/index.html#ui-for-field
最好的
這篇關(guān)于Parsley.js - 在指定元素中顯示錯誤的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!
【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!