I am using parsley.js and I have to dynamically show/hide validation according to the data the user has selected.
I have read this SO post to dynamically add or remove required fields to be validated by parsley, which was helpful.
But how do I dynamically remove and add the maxlength for an input field?
I have tried the following two options:
$('input').attr('data-parsley-maxlength', 'true');
$('input').attr('data-parsley-maxlength', true);
But the above gives the following error message:
This value is too long. It should have true characters or fewer.