title: Add href in switch case JavaScript
body: <p>When displaying a picture how to specify a redirect to the site "href"? For each picture separately link.</p>
  
  <pre><code>var images = document.querySelectorAll('.img');
  
  for (var i = images.length; i--;) images[i].addEventListener('click', change);
  
  function change() {
    switch (this.value) {
      case "colour1":
        image = '&lt;img src="https://"&gt;&lt;/img&gt;';
        break;
      case "colour2":
        image = '&lt;img src="https://"&gt;&lt;/img&gt;';
        break;
      case "colour3":
        image = '&lt;img src="https://"&gt;&lt;/img&gt;';
        break;
  
      default:
        image = '&lt;img src="#!"&gt;&lt;/img&gt;';
    }
  
    document.getElementById("output-image").innerHTML = image;
  }
  </code></pre>