title: Ajax and Show-Hide based on Select Option jQuery
body: <p>Hello StackOverflow community,</p>
  
  <p>I tried to implement a dropdown with Show-Hide based on Select Option jQuery it's working. </p>
  
  <p>But when I switch the pages the <strong>javascript won't work anymore</strong>. I have it from here <a href="https://codepen.io/atelierbram/pen/gusxF" rel="nofollow noreferrer">https://codepen.io/atelierbram/pen/gusxF</a></p>
  
  <p>I altered my version to my needs:</p>
  
  <pre><code>&lt;div class="dropbutton dropdown"&gt; 
              &lt;select id="colorselector"&gt;
                  &lt;option value="leipzig"&gt;Leipzig&lt;/option&gt;
                  &lt;option value="raststatt"&gt;Raststatt&lt;/option&gt;   
              &lt;/select&gt;
          &lt;/div&gt;
   &lt;div class="output"&gt;
     &lt;div id="leipzig"&gt;My Output1&lt;/div&gt;
     &lt;div id="raststatt"&gt;My Output2&lt;/div&gt;
   &lt;/div&gt;
  
  
   $(function() {
    $('#colorselector').change(function(){
      $('.colors').hide();
      $('#' + $(this).val()).show();
    });
   });
  </code></pre>
  
  <p>Thank you  and best wishes, raikas.</p>