title: javascript: identical div id twice on page
body: <p>I need to figure out if I can perform the same javascript action on two identical  elements with the same ID.</p>
  
  <p>I have a box that appears twice on the page with the same content:</p>
  
  <pre><code>&lt;div class="my_box" id="23"&gt; Some bit 23 &lt;/div&gt;
  
  &lt;div class="my_box" id="23"&gt; Some bit 23 &lt;/div&gt;
  </code></pre>
  
  <p>Then I find that element: (or those?)</p>
  
  <pre><code>var my_box_find = document.getElementsByClassName('my_box');
  </code></pre>
  
  <p>and after some processing/calculations want to replace the innerHTML of /both/ boxes:</p>
  
  <pre><code>document.getElementById(my_box_find[i].id).innerHTML = 'New bit 23';
  </code></pre>
  
  <p>This is an extremely simplified example. But it works when the element I am trying to change appears only once. If it appears twice, only the first instance will be changed...</p>
  
  <p><em>Thinking out loud:</em> I supposed I could append the ID with some random number to make each box pseudo-unique... but then this will do the calculations twice unnecessarily... I want them both to update at the same time with the same information.</p>