title: Javascript - If drop down is selected, change image in a container
body: <p>Hey guys. I'm trying to change the image in a container with what I thought was simple javascript, but can't seem to figure it out. "cover-image" is the container where the image is, and "txtMontage" is the ID of the drop down list. If I run this as is, no mater what I select the image is set by the first if statement, and then the drop down gets stuck on it so I can't select anything else.</p>
  
  <p>Any ideas on how to fix this? Thanks.</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      function showPreview() {
  
          var image = document.getElementById("cover-image");
          var dropd = document.getElementById("txtMontage");
  
          if (dropd.value = "abrasives") {
              var container= "img/abrasives.jpg";
              image.src = container;
          }
          else if (dropd.value = "industrial") {
              var container= "img/gen-industrial.jpg";
              image.src = container;
          }
  
      }
  &lt;/script&gt;
  </code></pre>