title: Using javascript to change width of multiple images with same id
body: <p>I have a page with multiple images with the same <code>id</code>, I want to use javascript to size each of these depending on their original size. It only seems to check the first instance of the image and not the others, is there any way to get this working on all images?</p>
  
  <pre><code>&lt;img id="myImg" src="compman.gif" width="100" height="98"&gt;
  &lt;img id="myImg" src="compman.gif" width="49" height="98"&gt;
  
  &lt;p id="demo"&gt;&lt;/p&gt;
  
  &lt;button onclick="myFunction()"&gt;Try it&lt;/button&gt;
  
  &lt;script&gt;
  
  &lt;script&gt;
  var x = document.getElementById("myImg").width;
  var yourImg = document.getElementById('myImg');
  if(x &lt; 50) {
      yourImg.style.height = '100px';
      yourImg.style.width = '200px';
  }
  &lt;/script&gt;
  </code></pre>