title: How can I dynamically add and remove form fields to be validated by Parsley.js?
body: <p>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 ones to Parsley validation, depending on what someone selects in a select drop down ('#manufacturer').</p>
  
  <p>Here is my markup:</p>
  
  <pre><code>&lt;select name="manufacturer" id="manufacturer" parsley-required="true" data-error-message="Please select a manufacturer."&gt;
  
      &lt;option value="apple"&gt;Apple&lt;/option&gt;
  
      &lt;option value="blackberry"&gt;Blackberry&lt;/option&gt;
  
      &lt;option value="htc"&gt;HTC&lt;/option&gt;
  
      &lt;option value="huawei"&gt;Huawei&lt;/option&gt;
  
      &lt;option value="lg"&gt;LG&lt;/option&gt;
  
      &lt;option value="motorola"&gt;Motorola&lt;/option&gt;
  
      &lt;option value="nokia"&gt;Nokia&lt;/option&gt;
  
      &lt;option value="samsung"&gt;Samsung&lt;/option&gt;
  
      &lt;option value="sony"&gt;Sony&lt;/option&gt;
  
      &lt;option value="sony-ericsson"&gt;Sony Ericsson&lt;/option&gt;
  
  &lt;/select&gt;
  </code></pre>
  
  <p>Here is my JS:</p>
  
  <pre><code>//init parsley
  $('#registrations').parsley();
  
  $('#manufacturer').change(function() {
  
          //define selected value
          var manufacturer = $(this).val();
  
          //destroy parsley
          $('#registrations').parsley('destroy');
  
          //remove all models selects from parsley validation
          //if someone has previously selected a different manufacturer
          $('#registrations').parsley('removeItem', '#apple-models');
          $('#registrations').parsley('removeItem', '#blackberry-models');
          $('#registrations').parsley('removeItem', '#htc-models');
          $('#registrations').parsley('removeItem', '#huawei-models');
          $('#registrations').parsley('removeItem', '#lg-models');
          $('#registrations').parsley('removeItem', '#motorola-models');
          $('#registrations').parsley('removeItem', '#nokia-models');
          $('#registrations').parsley('removeItem', '#samsung-models');
          $('#registrations').parsley('removeItem', '#sony-models');
          $('#registrations').parsley('removeItem', '#sony-ericsson-models');
  
          //add corresponding models select to parsely
          $('#registrations').parsley('addItem', '#'+manufacturer+'-models');
  
          //reinit parsley
          $('#registrations').parsley();
  
      });
  </code></pre>
  
  <p>This isn't working but I don't know why.</p>