title: JQuery getting dynamic values and populate hidden form fields
body: <p>I have a series of divs that load each has a dynamic id name based on a database result.</p>
  
  <p>Within each div are several hidden input text fields that all have the same name and id.</p>
  
  <p>The user clicks a href which is dynamically generated from the database launching colorbox. For example () </p>
  
  <p>On the opening div is a button. When the user clicks this button it submits a form. </p>
  
  <p>As it is now it sumbits only the values of the first instance of the fields (for example Yellow, digital-world, Digital Revolution). </p>
  
  <p>It is suppsoed to submit the values of the url that is active. For example, if the user clicks (">) then it should submit Blue, abstract, Abstract Panel. Instead of Yellow, digital-world, Digital Revolution.</p>
  
  <p>In addition, there are scroll buttons on the colorbox so for example the user can click a next button to load the next set of values. Ie. if he is on  and clicks the next button he is suddenly on  so if he clicks the button on here it should submit the correct values ie. Blue, abstract, Abstract Panel.</p>
  
  <p>Does this make sense?</p>
  
  <p>Let me show...</p>
  
  <pre><code>&lt;div class="doneit"&gt;
  &lt;div style="float:left;"&gt;&lt;a href="#container" id="02_Digital_Revolution_Yellow" target="Yellow" title="digital-world" class="lightbox-image inline"&gt;&lt;img src="/videos/digital-world/Yellow/02_Digital_Revolution_Yellow.jpg" &gt;&lt;/a&gt;&lt;/div&gt;
  div class="doit"&gt;&lt;a href="http://www.url.com/folder/212.htm" class="playvideo"&gt;&lt;/a&gt;&lt;/div&gt;
  &lt;div style="height:70px;"&gt;&lt;/div&gt;
  &lt;input type="hidden" id="Product_Vid_1" name="Product_Vid_1" value="Yellow"&gt;
  &lt;input type="hidden" id="Product_Dir_1" name="Product_Dir_1" value="digital-world"&gt;
  &lt;input type="hidden" id="Product_Name_1" name="Product_Name_1" value="Digital Revolution"&gt;
  &lt;/div&gt;          
  
  &lt;div class="doneit"&gt;
  &lt;div style="float:left;"&gt;&lt;a href="#container" id="06_Abstract_Panel_Blue" target="Blue" title="abstract" class="lightbox-image inline"&gt;&lt;img src="/videos/abstract/Blue/06_Abstract_Panel_Blue.jpg"&gt;&lt;/a&gt;&lt;/div&gt;
  &lt;div class="doit"&gt;&lt;a href="http://www.url.com/folder/349.htm" class="playvideo"&gt;&lt;/a&gt;&lt;/div&gt;
  &lt;div style="height:70px;"&gt;&lt;/div&gt;
  &lt;input type="hidden" id="Product_Vid_1" name="Product_Vid_1" value="Blue"&gt;
  &lt;input type="hidden" id="Product_Dir_1" name="Product_Dir_1" value="abstract"&gt;
  &lt;input type="hidden" id="Product_Name_1" name="Product_Name_1" value="Abstract Panel"&gt;  
  &lt;/div&gt;          
  
  &lt;div class="doneit"&gt;
  &lt;div style="float:left;"&gt;&lt;a href="#container" id="10_Abstract_Discs_Red" target="Red" title="abstract" class="lightbox-image inline"&gt;&lt;img src="/videos/abstract/Red/10_Abstract_Discs_Red.jpg"&gt;&lt;/a&gt;&lt;/div&gt;
  &lt;div class="doit"&gt;&lt;a href="http://www.url.com/folder/353.htm" class="playvideo"&gt;&lt;/a&gt;&lt;/div&gt;
  &lt;div style="height:70px;"&gt;&lt;/div&gt;
  &lt;input type="hidden" id="Product_Vid_1" name="Product_Vid_1" value="Red"&gt;
  &lt;input type="hidden" id="Product_Dir_1" name="Product_Dir_1" value="abstract"&gt;
  &lt;input type="hidden" id="Product_Name_1" name="Product_Name_1" value="Abstract Disks"&gt;  
  &lt;/div&gt;          
  
  &lt;div class="doneit"&gt;
  &lt;div style="float:left;"&gt;&lt;a href="#container" id="electric-purple-grid" target="Purple" title="electric-effect" class="lightbox-image inline"&gt;&lt;img src="/videos/electric-effect/Purple/electric-purple-grid.jpg"&gt;&lt;/a&gt;&lt;/div&gt;
  &lt;div class="doit"&gt;&lt;a href="http://www.url.com/folder/129.htm" class="playvideo"&gt;&lt;/a&gt;&lt;/div&gt;
  &lt;div style="height:70px;"&gt;&lt;/div&gt;
  &lt;input type="hidden" id="Product_Vid_1" name="Product_Vid_1" value="Purple"&gt;
  &lt;input type="hidden" id="Product_Dir_1" name="Product_Dir_1" value="electric-effect"&gt;
  &lt;input type="hidden" id="Product_Name_1" name="Product_Name_1" value="Electric Grid"&gt;       
  &lt;/div&gt;
  
  &lt;div style="display:none"&gt;
  &lt;div id="container"&gt;&lt;div id="video"&gt;&lt;/div&gt;
  &lt;div id="doesit"&gt;
  
  &lt;script type="text/javascript"&gt;
  function submitMyForm(){
  $('#Product_color_16').val($('#Product_Vid_1').val());
  $('#Product_Dir_16').val($('#Product_Dir_1').val());
  $('#Product_Name_16').val($('#Product_Name_1').val());
  $('#myform').submit();
  }
  &lt;/script&gt;
  
  &lt;form name="myform" action="/thisurl.asp" method="post"&gt;
  &lt;input type="hidden" id="Product_color_16" name="Product_color_16" value=""&gt;
  &lt;input type="hidden" id="Product_Dir_16" name="Product_Dir_16" value=""&gt;
  &lt;input type="hidden" id="Product_Name_16" name="Product_Name_16" value=""&gt;
  
  &lt;button class="addtobutton addtocart" onclick="submitMyForm();"&gt;&lt;/button&gt;
  
  &lt;/form&gt;
  
  &lt;/div&gt;&lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Thanks for any and all help!</p>