jQuery custom extension throws not a function error

When I try to run this function

(function($) {
    $.fn.urlHash = function()
    {
        return document.URL.substr(document.URL.indexOf('#')+1);
    };
})(jQuery);

like so $.urlHash() I get an error in Google Chrome console saying urlHash() is not a function.

From what I could see (by Googling), the extension is written correctly. What am I doing wrong?


Source: jquery

Leave a Reply