ElGabbu ElGabbu - 1 year ago 105
HTML Question

html anchor works only once

I am ashamed to say that I have an anchor issue.

So I have this code:

<a name="map"></a>

$("div.store_list").click(function() {
//do some stuff
location.href = location.href + '#map'

When doing the first click it works fine. And the URL changes to:


Second click the URL changes to the following and it doesn't work:


Any suggestions? Thanks

Answer Source

Issue was solved using: document.location = "#map";

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download