title: add class to element from another page
body: <p>I need to add a class (<code>.open</code>) to an element (<code>h2</code>) on another page from the home page depending on which option is clicked.</p>
  
  <p>The jquery below shows a line of code that i've written which although doesn't work gives you an idea of what i'm trying to do.</p>
  
  <p>Jquery</p>
  
  <pre><code>//open service section from home page
  
  var hash = window.location.hash;
  if(hash != "") {
      var id = hash.substr(1); 
      document.getElementById(id).style.display = 'block'; 
      //document.getElementById(id).previous('h2').addClass( "open" ); //CODE THAT DOESN'T WORK
  }
  </code></pre>
  
  <p>HTML (This is what i'm trying to ahceive. As you can see the h2 contains the <code>.open</code> tag)</p>
  
  <pre><code> &lt;h2 class="section-heading toggle open"&gt;heading title&lt;/h2&gt;
       &lt;div id="content1" class="slide-content"&gt;&lt;/div&gt;
       &lt;/div&gt;
  </code></pre>