Get Hash from URL

by Taufik Nurrohman

HTML

<a href="#top">URL 1</a>
<a href="http://www.namasitus.com/eksport.html#section56">URL 2</a>
<a href="http://www.namasitus.com/eksport.html#bottom">URL 3</a>
<a href="http://www.namasitus.com/eksport.html#comment12345">URL 4</a>

CSS

a {display:block;}

JavaScript

$('a').click(function() {
    var hash = this.href.split('#')[1];
    alert(hash);
    return false;
});