title: Changing the SRC of an image depending on the selected option
body: <p>I have to change the atribute &quot;src&quot; of multiple images with different  items.</p>
  <p>So I'm trying to do it with this code:</p>
  <p>script</p>
  <pre><code>function ColorSrcSet(ImageId) {
    var imgID = document.getElementById(ImageId);
    var optionValue = $(this).attr(&quot;value&quot;);
    imgID.src = optionValue;
  }
  </code></pre>
  <p>html</p>
  <pre><code>  &lt;select onchange=&quot;ColorSrcSet('img-1');&quot;&gt;
      &lt;option value=&quot;../img/1.png&quot;&gt;Amarillo&lt;/option&gt;
      &lt;option value=&quot;../img/2.png&quot;&gt;Naranja&lt;/option&gt;
      &lt;option value=&quot;../img/3.png&quot;&gt;&lt;/option&gt;
    &lt;/select&gt;
  
    &lt;img id=&quot;img-1&quot; src=&quot;../img/transparent.png&quot;&gt;&lt;/img&gt;
  </code></pre>
  <p>It gives me an error and set the &quot;SRC&quot; as undefined.</p>
  <p>¿Do anyone know how to fix it?</p>