select not working after .clone
<p>I am cloning a block of HTML and then appending it to a div. </p>

<pre><code>var part = $('#parts_tpl').clone();
$('#parts_tpl').after(part);
</code></pre>

<p>The HTML contains a form and for some reason, the select boxes are not updating there values in the newly cloned HTML. If I try to update the original select box value, it works. I just doesn't work with the newly cloned form. </p>

<p>I have ensured that the newly created select boxes have a unique id, name, etc. This is how I'm doing it:</p>

<pre><code>// increment ids and names for select tags
    $('#' + content.attr('id')).find('select').each(function() {
        var id = $(this).attr('id') + partID;
        var name = $(this).attr('name') + partID;

        if ($(this).attr('id')) { $(this).attr('id', id); }
        if ($(this).attr('name')) { $(this).attr('name', name); }
    });
</code></pre>

<p>This is what my HTML looks like:</p>

<pre><code>&lt;div class="parts" id="parts_tpl"&gt;
   &lt;fieldset&gt;
      &lt;label&gt;Part Specifications&lt;/label&gt;
      &lt;a href="#" class="btn removePartBtn" id="removePartBtn" style="float: right; display: none;"&gt;Remove Part&lt;/a&gt;
      &lt;section&gt;
         &lt;label for="quote_partSpecification_description"&gt;Description&amp;nbsp;&lt;span class="required"&gt;&amp;nbsp;&lt;/span&gt;&lt;/label&gt;
         &lt;div&gt;
            &lt;input type="text" id="quote_partSpecification_description" name="quote_partSpecification_description" required="" class="text"&gt;
         &lt;/div&gt;
      &lt;/section&gt;
      &lt;section&gt;
         &lt;label for="quote_partSpecification_estimatedFirstYearVolume"&gt;Estimated Year 1 Volume (mft)&amp;nbsp;&lt;span class="required"&gt;&amp;nbsp;&lt;/span&gt;&lt;/label&gt;
         &lt;div&gt;
            &lt;!--
               &lt;input type="text" id="quote_partSpecification_estimatedFirstYearVolume" name="quote_partSpecification_estimatedFirstYearVolume"&gt;
               --&gt;
            &lt;input id="quote_partSpecification_estimatedFirstYearVolume" name="quote_partSpecification_estimatedFirstYearVolume" type="number" class="integer" required=""&gt;
         &lt;/div&gt;
      &lt;/section&gt;
      &lt;section&gt;
         &lt;label for="quote_partSpecification_estimatedSecondYearVolume"&gt;Estimated Year 2 Volume (mft)&amp;nbsp;&lt;span class="required"&gt;&amp;nbsp;&lt;/span&gt;&lt;/label&gt;
         &lt;div&gt;
            &lt;!--
               &lt;input type="text" id="quote_partSpecification_estimatedSecondYearVolume" name="quote_partSpecification_estimatedSecondYearVolume"&gt;
               --&gt;
            &lt;input id="quote_partSpecification_estimatedSecondYearVolume" name="quote_partSpecification_estimatedSecondYearVolume" type="number" class="integer" required=""&gt;
         &lt;/div&gt;
      &lt;/section&gt;
      &lt;section&gt;
         &lt;label for="quote_partSpecification_estimatedOrderVolume"&gt;Estimated Order Volume (mft)&lt;/label&gt;
         &lt;div&gt;
            &lt;!--
               &lt;input type="text" id="quote_partSpecification_estimatedOrderVolume" name="quote_partSpecification_estimatedOrderVolume"&gt;
               --&gt;
            &lt;input id="quote_partSpecification_estimatedOrderVolume" name="quote_partSpecification_estimatedOrderVolume" type="number" class="integer"&gt;
         &lt;/div&gt;
      &lt;/section&gt;
      &lt;section&gt;
         &lt;label for="quote_partSpecification_partType"&gt;Part Type&amp;nbsp;&lt;span class="required"&gt;&amp;nbsp;&lt;/span&gt;&lt;/label&gt;
         &lt;div&gt;
            &lt;div class="selector" id="uniform-quote_partSpecification_partType"&gt;
               &lt;span&gt;Frame&lt;/span&gt;
               &lt;select name="quote_partSpecification_partType" id="quote_partSpecification_partType" required="" style="opacity: 0;"&gt;
                  &lt;optgroup label="Select Part Type"&gt;
                     &lt;option value="Frame"&gt;Frame&lt;/option&gt;
                     &lt;option value="Sash"&gt;Sash&lt;/option&gt;
                     &lt;option value="Single Wall Accessory"&gt;Single Wall Accessory&lt;/option&gt;
                     &lt;option value="Hollow Accessory"&gt;Hollow Accessory&lt;/option&gt;
                  &lt;/optgroup&gt;
               &lt;/select&gt;
            &lt;/div&gt;
         &lt;/div&gt;
      &lt;/section&gt;
      &lt;section&gt;
         &lt;label for="quote_partSpecification_weightPerFoot"&gt;Weight per ft&lt;/label&gt;
         &lt;div&gt;
            &lt;!--
               &lt;input type="text" id="quote_partSpecification_estimatedOrderVolume" name="quote_partSpecification_estimatedOrderVolume"&gt;
               --&gt;
            &lt;input id="quote_partSpecification_weightPerFoot" name="quote_partSpecification_weightPerFoot" type="number" class="decimalToTenThousands g2"&gt;
         &lt;/div&gt;
      &lt;/section&gt;
      &lt;section&gt;
         &lt;label for="quote_partSpecification_dieNumber"&gt;Die Number (&lt;em&gt;if existing&lt;/em&gt;)&lt;/label&gt;
         &lt;div&gt;
            &lt;input type="text" id="quote_partSpecification_dieNumber" name="quote_partSpecification_dieNumber" class="text"&gt;
         &lt;/div&gt;
      &lt;/section&gt;
      &lt;section&gt;
         &lt;label for="quote_partSpecification_plantToProducePart"&gt;Plant to Product Part&amp;nbsp;&lt;span class="required"&gt;&amp;nbsp;&lt;/span&gt;&lt;/label&gt;
         &lt;div&gt;
            &lt;div class="selector" id="uniform-quote_partSpecification_plantToProducePart"&gt;
               &lt;span&gt;Plant 1&lt;/span&gt;
               &lt;select name="quote_partSpecification_plantToProducePart" id="quote_partSpecification_plantToProducePart" required="" style="opacity: 0;"&gt;
                  &lt;optgroup label="Select Plant"&gt;
                     &lt;option value="Plant 1"&gt;Plant 1&lt;/option&gt;
                     &lt;option value="Plant 2"&gt;Plant 2&lt;/option&gt;
                     &lt;option value="Plant 13"&gt;Plant 13&lt;/option&gt;
                     &lt;option value="Plant 14"&gt;Plant 14&lt;/option&gt;
                     &lt;option value="Bristol"&gt;Bristol&lt;/option&gt;
                     &lt;option value="To Be Determined"&gt;To Be Determined&lt;/option&gt;
                  &lt;/optgroup&gt;
               &lt;/select&gt;
            &lt;/div&gt;
         &lt;/div&gt;
      &lt;/section&gt;
      &lt;section&gt;
         &lt;label for="quote_partSpecification_packaging"&gt;Packaging&lt;/label&gt;
         &lt;div&gt;
            &lt;div class="selector" id="uniform-quote_partSpecification_packaging"&gt;
               &lt;span&gt;Metal Rack&lt;/span&gt;
               &lt;select name="quote_partSpecification_packaging" id="quote_partSpecification_packaging" style="opacity: 0;"&gt;
                  &lt;optgroup label="Select Packaging"&gt;
                     &lt;option value="Metal Rack"&gt;Metal Rack&lt;/option&gt;
                     &lt;option value="Wood Rack"&gt;Wood Rack&lt;/option&gt;
                     &lt;option value="Paperboard"&gt;Paperboard&lt;/option&gt;
                     &lt;option value="Polybag"&gt;Polybag&lt;/option&gt;
                     &lt;option value="Other"&gt;Other&lt;/option&gt;
                     &lt;option value="Customer Supplied Rack"&gt;Customer Supplied Rack&lt;/option&gt;
                  &lt;/optgroup&gt;
               &lt;/select&gt;
            &lt;/div&gt;
         &lt;/div&gt;
      &lt;/section&gt;
      &lt;section&gt;
         &lt;label for="quote_partSpecification_cutLength"&gt;Cut Length (in)&lt;/label&gt;
         &lt;div&gt;
            &lt;!--
               &lt;input type="text" id="quote_partSpecification_cutLength" name="quote_partSpecification_cutLength"&gt;
               --&gt;
            &lt;input id="quote_partSpecification_cutLength" name="quote_partSpecification_cutLength" type="number" class="integer"&gt;
         &lt;/div&gt;
      &lt;/section&gt;
   &lt;/fieldset&gt;
&lt;/div&gt;
</code></pre>

<p>Does anyone know whats going on? </p>

<p><strong>Things I have tried:</strong></p>

<ul>
<li><a href="http://stackoverflow.com/questions/742810/clone-isnt-cloning-select-values">Clone isn&#39;t cloning select values</a></li>
<li><a href="https://github.com/spencertipping/jquery.fix.select-clone/blob/master/jquery.fix.select-clone.js" rel="nofollow">https://github.com/spencertipping/jquery.fix.select-clone/blob/master/jquery.fix.select-clone.js</a></li>
</ul>
