title: Using a jquery variable as an href selector
body: <p>Apologies for this basic question, but I am noob stumped.</p>
  
  <p>The below code works fine. What I wish to do is take the hash stored as a variable and target an href on the page with the same hash/target id, (eg. page that link is on = <code>page.php#options</code> , link= <code>&lt;a href="#options"&gt;</code> ), adding a class to the specific link. </p>
  
  <p>eg. instead of <code>#options</code> I'd like it to be whatever (if anything) is stored in the variable <code>hash</code>. I've tried many combinations of <code>$('[href="hash"]')</code> , <code>$('a[href=hash]')</code> etc, but my jquery isn't that fluent so I'm not sure where I am making mistakes. </p>
  
  <p>The only thing I can think is that the hash stored may not include the "#" which the targeted href calls for, but that might be a stretch.</p>
  
  <pre><code>$(document).ready(function() {
  
      var hash = window.location.hash;
  
      if(hash != "") {
          $('[href="#options"]').addClass("selected");
      }       
  });
  </code></pre>
  
  <p>I hope this makes sense, any insight would be appreciated.
  Thanks in advance.</p>