title: Get option value from select inside Smarty PHP loop (JQuery)
body: <p>So I need to append and un-append divs which contain the values of whichever option was selected, problem is that the method of displaying the select values in the first place is via. a for-each loop using Smarty PHP templates, and I am unable to find any documentation on how it can be achieved using this.</p>
  
  <p><strong>What I've tried:</strong> as you will see below I've tried creating a JavaScript variable inside the template file, but it only ever returns the value of the first option selected. I cannot figure out why I am only ever getting the first value taken from the loop.</p>
  
  <p>For example, if I have two items in a select 'A' and 'B', when selecting the value option, I will always just receive 'A' back as the value.</p>
  
  <p><strong>Smarty Template Code:</strong></p>
  
  <pre><code>&lt;select class="my_select" name="vlans_{$NetworkDTO-&gt;id}[]"&gt;
      {foreach from=$arrNetworkDTO item=NetworkDTO name=arr}
      &lt;option class="addOvmCardList" id="addNameDisk{$strIdTpl}" value="{$NetworkDTO-&gt;name|escape}"&gt;{$NetworkDTO-&gt;name}&lt;/option&gt;
      {/foreach}
  &lt;/select&gt;
  </code></pre>
  
  <p><strong>JQuery Code:</strong></p>
  
  <pre><code>$('a.addListOVM').click(function(){
  
      $(".my_select").change(function() {
  
          $('.addCardOVM').append(
                '&lt;div class="divform"&gt;&lt;label&gt;' + $(this).val() + '&lt;/label&gt;' +
                '&lt;a href=""&gt;-&lt;/a&gt;&lt;/div&gt;'
                  );              
      });                             
  
  });
  </code></pre>
  
  <p>Any help is appreciated.</p>