Getting Parsley 2.x working with Bootstrap 3 correctly

孤者浪人 提交于 2019-12-03 22:42:57

You should try:

classHandler: function(el) {
    return el.$element.closest(".form-group");
}

The el is an object from parsley (I have seen it using chrome dev console) and he has a $element field with the JQuery element :)

Full code working:

$("#register_form").parsley({
    successClass: "has-success",
    errorClass: "has-error",
    classHandler: function(e) {
        return e.$element.closest('.form-group');
    },
    errorsWrapper: "<span class='help-block'></span>",
    errorTemplate: "<span></span>"
});
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!