title: Reload page with anchor using Javascript or Jquery
body: <p>I am using anchors in my URL as a kind of variable for JavaScript, eg:</p>
  
  <pre><code>mysite.com/itempage.html#item75
  </code></pre>
  
  <p>This works when I click the link on any other page, but not on the actual page in question (itempage.html).</p>
  
  <p>Instead of reloading the page, clicking the link simply changes the URL. Since the page does not reload, none of my JavaScript runs again.</p>
  
  <p>Does anyone know a way to reload the page with the new url?</p>
  
  <p>So far I have tried:</p>
  
  <p><strong>HTML</strong></p>
  
  <pre><code>&lt;div id="itemmenu"&gt;
    &lt;a id="item75" href="#"&gt;Item 75&lt;/a&gt;
    &lt;a id="item11" href="#"&gt;Item 11&lt;/a&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>JQUERY</strong></p>
  
  <pre><code>$( "#itemmenu a" ).each(function(index) { 
      $(this).on("click", function(){
          var linkid = $(this).attr('id'); 
          var winloc = "mysite.com/itempage#" + linkid;
          window.location  = winloc;
      });
  });
  </code></pre>