Remove hash tag values from url based on link clicked
<p>I'm using the script below to add to the url the href of the clicked link. So mysite.com becomes, mysite.com#a1, what I still need to achieve is that if I click on that link again it will remove #a1, so mysite.com#a1, would go back to mysite.com, or mysite.com#a1#a2 becomes mysite.com#a2.</p>

<pre><code>//creates href for each of my links
$('.contentTrigger a').attr('href', function(i, value) {
    return "#a" + (i+1);
});

//adds href value to url
$('.contentTrigger a').click(function(event) {
    var currentHash = window.location.hash;
    window.location.hash = currentHash + this.hash;
});
</code></pre>

<p>Thanks</p>
