Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Refresh the page and then go to a specific div

How can I use javascript to reload page and go to a specific div when a button is clicked?

function reloadAgreement() {
  location.reload();
}

<li><a href="" onclick="reloadAgreement();">Return to Store Info</a></li>
like image 562
msafi Avatar asked Dec 17 '25 13:12

msafi


1 Answers

function gototab(reload)
   {
    window.location.hash = '#tab2';
    window.location.reload(true);
 }

Return to Store Info

from here Reload page with different anchor

edit:

To clarify, the section that says "#tab2" is the 'id' attribute of the div you want the page to go to when the link is clicked.

like image 88
Daymon Schroeder Avatar answered Dec 20 '25 03:12

Daymon Schroeder



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!