Try $("form").parsley().reset();
Dynamically adding inputs and bind validation in Parsley.js 2.0.0 rc3
-
13-06-2023 - |
Question
In the new version of Parsley.js 2.0.0 rc3 how do you enable validation for dynamically added inputs?
Before I had destroyed the validation then re-initialized validation. However my understanding is you shouldn't have to do this in the new version, not sure if that is correct or not.
La solution
Autres conseils
Well for now I have done the same thing as I did using version 1. After I add a new input I destroy and reset parsley on the form.
$("form").parsley().destroy();
$("form").parsley();
$('#fieldId').parsley('addConstraint', { required: true });
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow