Parsley.js - Displaying Errors in a Specified Element

Alix Axel picture Alix Axel · Jan 30, 2013 · Viewed 27.9k times · Source

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.

Answer

guillaumepotier picture guillaumepotier · Mar 2, 2013

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.

More info here: http://parsleyjs.org/doc/index.html#ui-for-field

Best