title: jQuery: Add class based on url parameters
body: <p>I have an 'h1' tag that i need to add a class to change its colour based on the url parameter. I have two parameters that are passed so depending on which one a different class is added.</p>
  
  <p>I have seen a previous post by <a href="https://stackoverflow.com/a/9983822/2369713">@Matt Martin with an answer by @Florian Margaine</a> which uses Switch statements which looks like a nice method, nut i cannot seem to get it to work.</p>
  
  <p>I have tried the following with no success:</p>
  
  <p>HTML:</p>
  
  <p><code>&lt;h1 id="head" class="page-head"&gt;About Right to Manage for&lt;/h1&gt;</code></p>
  
  <p>jQuery:</p>
  
  <pre><code>$(function() {
   switch (window.location.pathname) {
     case '?type=private':
      $('#head').addClass('private')
     case '?type=retirement':
      $('#head').addClass('retirement')
  }
  });
  </code></pre>
  
  <p>so I would have either of the following:</p>
  
  <p><code>&lt;h1 id="head" class="page-head private"&gt;About Right to Manage for&lt;/h1&gt;</code></p>
  
  <p>or</p>
  
  <p><code>&lt;h1 id="head" class="page-head retirement"&gt;About Right to Manage for&lt;/h1&gt;</code></p>