title: Change location.hash without page scrolling
body: <pre><code>    hash = hash.replace( /^#/, '' );
  var node = $( '#' + hash );
  if ( node.length ) {
    node.attr( 'id', '' );
  }
  document.location.hash = hash;
  if ( node.length ) {
    node.attr( 'id', hash );
  }
  </code></pre>
  
  <p>Im having trouble with the code above, which I grabbed from this article: <a href="https://stackoverflow.com/questions/1489624/modifying-document-location-hash-without-page-scrolling">Modifying document.location.hash without page scrolling</a>, trying to temporarily replace the id of a div while I change the location.hash to said id. hash comes up with this error in the console: Uncaught ReferenceError: hash is not defined. I'm new to JS and need a little guidance! thanks :)</p>