title: How do I open a link in the same window and tab using the onclick event?
body: <p>I have a page that has multiple divs. I want to get some information from my database to display in some of those divs and I also want it to be displayed as I click on a link to the home div.  </p>
  
  <p>I also need the page to be refreshed or reopened in the same window (not in a new page or tab). Last of all, I need the page to be in the home div. </p>
  
  <p>I tried the code below and it didn't work:</p>
  
  <pre><code>&lt;a href="#home" onclick="window.open('index.jsp#home')" &gt;home&lt;/a&gt;
  
  &lt;a href="#home" onclick="location.reload()"&gt;home&lt;/a&gt;
  
  &lt;a href="#home" onclick="location.href='index.jsp'"&gt;home&lt;/a&gt;
  </code></pre>