0

I have i button that puts the hash (#feed) and i want when i am on this page with that has, when click the button again it reloads the page with that hash(#feed).

Is there some way to do that?

Artjom B.
  • 61,146
  • 24
  • 125
  • 222
Lucca
  • 55
  • 6

1 Answers1

1

You can trigger an onclick event and refresh the page with location.reload(); :

function reload(e){
    e.preventDefault();
    location.href = e.target.href;
    location.reload();
}
a {
    display: block;
    width: 100px;
    height: 25px;
    background: lightgray;
    text-align: center;
    border-radius: 5px;
}
<a href="#feed" onclick="reload(event);">ok</a>
coderLMN
  • 3,076
  • 1
  • 21
  • 26