I am stripping url with "document.location.hash" and trying to check whats left behind from current url. I dont want to use any plugin and dont want to learn result from trigger events like click. Need to learn url change instantly and contemporary.
jQuery:
$(function() {
    $(document).location().change(function() {//this part is not working
        var anchor = document.location.hash;
        if( anchor === '#one' ) {
            alert('current url = #one');
        }else if ( anchor === '#two' ) {
            alert('current url = #two');
        }else if ( anchor === '#three' ) {
            alert('current url = #three');
        }
        console.log(anchor);
    });
});
html:
<a href="#one">one</a>
<a href="#two">two</a>
<a href="#three">three</a>
deep note: i have read these questions and cout find what i am looking for: How to detect URL change in JavaScript + How to change the current URL in javascript?
 
     
     
    