title: Multiple Select onChange create dynamic fields
body: <p>I'm trying to accomplish when an option is selected/unselected on a multiple select the onChange event will call a function to add or remove the dynamic field that is selected/unselected.</p>
  
  <p>I've been trying for a few hours to think of the best logical approach to get this to work. </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>$('.multi-select').on('change', function() {
    $.each($(this).val(), function() {
     /* [ Some logic to check if a dynamic input should be removed or added. ]*/
    });
  });</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;select class="multi-select" multiple&gt;
    &lt;option value="0" selected&gt;Col 0&lt;/option&gt;
    &lt;option value="1"&gt;Col 2&lt;/option&gt;
    &lt;option value="2" selected&gt;Col 2&lt;/option&gt;
    ...
  &lt;/select&gt;
  
  &lt;div class="dynamic-fields"&gt;
    &lt;input type="text" name="option[0]" value="asc"&gt;
    &lt;input type="text" name="option[2]" value="desc"&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>I just need some guidance with the best approach that I should take.</p>