I want to alter the positioning of each error message. That is display the error message in the respective . By using th
You can do this by overwriting Parsley's default options. (note: I'm talking about the latest version [v2.0], which I suggest you use) You basically want to give Parsley a method that will find the .errorBlock
container based on the input field. It would look something like this:
var parsleyConfig = {
errorsContainer: function(pEle) {
var $err = pEle.$element.siblings('.errorBlock');
return $err;
}
}
$('#yourFormID').parsley(parsleyConfig);
And here's a live example.
Note: using this method you can't use the parsley-validate
attribute that Makrand suggests. Calling .parsley
on your form does the same thing, except you can add your custom options to it. Also, you need to prefix all of your parsley attributes with data-
, because they're data attributes (as of v2.0).