How can I dynamically add and remove form fields to be validated by Parsley.js?

前端 未结 3 707
我在风中等你
我在风中等你 2020-12-15 06:32

I have a form (\'#registrations\') that I am validating with Parsley.js and so far it is working fine. However, I am trying to dynamically remove form fields and add new one

3条回答
  •  悲哀的现实
    2020-12-15 07:19

    I had this issue while working with validates-if-empty set to true. Simply setting this to false didn't have any effect. I had to actually remove the attributes. On validation parley automatically detected the changes.

    $('input').removeAttr('data-parsley-required');
    $('input').removeAttr('data-parsley-validate-if-empty');
    

提交回复
热议问题