Parsley.js Bootstrap 4 configuration

Anyone looking for parsley.js options for bootstrap 4?

$('form.validate').parsley({
successClass: "has-success",
errorClass: "has-danger",
classHandler: function(el) {
return el.$element.closest(".form-group");
},
errorsWrapper: "",
errorTemplate: ""
});

window.Parsley.on('field:error', function() {
this.$element.addClass('form-control-danger');
});

window.Parsley.on('field:success', function() {
this.$element.addClass('form-control-success');
});

2 thoughts on “Parsley.js Bootstrap 4 configuration

Leave a Reply to Ammar Gazali Cancel reply

2020 sucks.