Skip to content

Instantly share code, notes, and snippets.

@sagar-gavhane
Created June 22, 2018 18:48
Parsley plugin initialization with tweaks to style Parsley for Bootstrap 4
// Parsley plugin initialization with tweaks to style Parsley for Bootstrap 4
$("#my-form").parsley({
errorClass: 'is-invalid text-danger',
successClass: 'is-valid', // Comment this option if you don't want the field to become green when valid. Recommended in Google material design to prevent too many hints for user experience. Only report when a field is wrong.
errorsWrapper: '<span class="form-text text-danger"></span>',
errorTemplate: '<span></span>',
trigger: 'change'
}) /* If you want to validate fields right after page loading, just add this here : .validate()*/ ;
// Parsley full doc is avalailable here : https://github.com/guillaumepotier/Parsley.js/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment