title: Multiple changeImage Instances
body: <p>Hopefully someone can help me. I'm using a JS image compare script which shows two images to be shown side by side and the user can compare them. It works like this:</p>
  
  <pre><code>&lt;div id="container1"&gt;
   &lt;!-- The before image is first --&gt;
   &lt;img id="img" src=" http://placehold.it/400x200&amp;text=1" /&gt;
   &lt;!-- The after image is last --&gt;
   &lt;img id="img-alt" src="http://placehold.it/400x200&amp;text=2" /&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>The script pulls the first img as the left image, and the second img as the right image. I've added two IDs because I've set up buttons and I'd like them to changeImage on either side so the two images aren't static, and multiple images can be selected and compared from a thumbnail gallery (per the user's selection).</p>
  
  <p>I found some code on here, which will affect the left side just fine. I've also added a button that will allow the left side to be changed.</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  function changeImage(a) {
      document.getElementById("img").src=a;
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>And the HTML: </p>
  
  <pre><code>Left side:
  &lt;button onclick='changeImage( "http://placehold.it/400x200&amp;text=Left" );'&gt;Left&lt;/button&gt;
  &lt;button onclick='changeImage( "http://placehold.it/400x200&amp;text=Left2");'&gt;Left2&lt;/button&gt;
  </code></pre>
  
  <p>Now, I'd like to create another set of buttons that affects the "img-alt" class as shown in the slider HTML - this would affect the right side. I have somewhat limited knowledge with Javascript, and if I add another script with "document.getElementById("img-alt").src=a;" nothing changes on the right side. Basically, I'd like buttons that affect the right side like so:</p>
  
  <pre><code>Right side:
  &lt;button onclick='changeImage( "http://placehold.it/400x200&amp;text=Right");'&gt;Right&lt;/button&gt;
  &lt;button onclick='changeImage("http://placehold.it/400x200&amp;text=Right2");'&gt;Right2&lt;/button&gt;
  </code></pre>
  
  <p>How can I associate these buttons to affect the 'img-alt' ID (second image)?</p>
  
  <p>I hope this makes sense. Please let me know if I need to clarify anything.</p>
  
  <p>Thanks!</p>