title: Javascript, how can i place value in div on class instead of id
body: <p>I'm working on an html form, with steps and on the last page an summary. This is working good, but now i want to show the value based on div class instead of div id, this because i want to show the value multiple times. This is the javascript:</p>
  
  <pre><code> &lt;SCRIPT TYPE="text/javascript"&gt;
   &lt;!-- 
   function copyText(e)
   {    
    document.getElementById( e.name + 'preview' ).innerHTML = e.value;
   }
   //--&gt;
   &lt;/SCRIPT&gt; 
  
  
  &lt;script&gt;
  $("text1preview").draggable({ containment: '#dragcontainer' });
  $("address1preview").draggable({ containment: '#dragcontainer' });
  $("titlepreview").draggable({ containment: '#dragcontainer' });
  $("zipcodepreview").draggable({ containment: '#dragcontainer' });
  $("descriptionpreview").draggable({ containment: '#dragcontainer' });
  $("wijkpreview").draggable({ containment: '#dragcontainer' });
  $("address2preview").draggable({ containment: '#dragcontainer' });
  $("tagspreview").draggable({ containment: '#dragcontainer' });
  $(".catidpreview").draggable({ containment: '#dragcontainer' });
  $("pricepreview").draggable({ containment: '#dragcontainer' });
  &lt;/script&gt;
  </code></pre>
  
  <p>And this is the summary html:</p>
  
  <pre><code>  &lt;tr&gt;
      &lt;td width="220"&gt;Samenvatting&lt;/td&gt;
      &lt;/tr&gt;
  &lt;tr&gt;
      &lt;td&gt;Categorie:&lt;/td&gt;
      &lt;td&gt;&lt;div class="categoryid"&gt;&lt;/div&gt;&lt;/td&gt;
      &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Titel van uw object:&lt;/td&gt;
      &lt;td&gt;&lt;div id="titlepreview"&gt;&lt;/div&gt;&lt;/td&gt;
     &lt;/tr&gt;
   &lt;tr&gt;
      &lt;td&gt;Adres:&lt;/td&gt;
      &lt;td&gt;&lt;div id="address1preview"&gt;  &lt;/div&gt; &lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
      &lt;td&gt;Postcode&lt;/td&gt;
      &lt;td&gt;&lt;div id="zipcodepreview"&gt;&lt;/div&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
      &lt;td&gt;Plaats:&lt;/td&gt;
      &lt;td&gt;&lt;div id="address2preview"&gt;&lt;/div&gt;&lt;/td&gt;
      &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Wijk:&lt;/td&gt;
      &lt;td&gt;&lt;div id="wijkpreview"&gt;&lt;/div&gt;&lt;/td&gt;
      &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Omschrijving:&lt;/td&gt;
      &lt;td&gt;&lt;div id="descriptionpreview"&gt;&lt;/div&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Tags:&lt;/td&gt;
      &lt;td&gt;&lt;div id="tagspreview"&gt;&lt;/div&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Prijs per periode:&lt;/td&gt;
      &lt;td&gt;&lt;div id="pricepreview"&gt;&lt;/div&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>