title: jQuery - Get url hash
body: <p>I have three tabs on a page</p>
  
  <ul>
  <li>Latest</li>
  <li>Expired</li>
  <li>Pending</li>
  </ul>
  
  <p>When each tab is active, a hash is added to the url: </p>
  
  <p><a href="http://example.com/com/#latest" rel="nofollow">http://example.com/com/#latest</a></p>
  
  <p>I am trying to add pagination fore each tab. So I was thinking of doing something like this: </p>
  
  <p><a href="http://example.com/com/#latest?p=5" rel="nofollow">http://example.com/com/#latest?p=5</a></p>
  
  <p>But I don't know how to get the hash value by itself. Using <code>$(location).attr('hash')</code> returns <code>#latest?p=5</code></p>
  
  <pre><code>if( $(location).attr('hash') ) {
      var tab = $(location).attr('hash');
  }else{
      var tab = "#latest";
  }
  </code></pre>