Skip to content

Instantly share code, notes, and snippets.

@sagar-gavhane
Created June 22, 2018 18:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sagar-gavhane/d2be3f23d356e50b09b0f21b27ee0ce8 to your computer and use it in GitHub Desktop.
Save sagar-gavhane/d2be3f23d356e50b09b0f21b27ee0ce8 to your computer and use it in GitHub Desktop.
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