Search code examples
javascripthtmlanchor

Navigating around website adds a [object object] to URL after clicking around anchors


Thanks for reading. I just wanted to know why i get a "/index.html#[object Object]" at the end of URL when clicking around anchors on a single page website.

I would also like to know if i can remove it if it isn't too game changing with htaccess or resolve the issue that is occuring?

If you require more information that isn't in this help request feel free to ask :) !

The website the-md.studio


Solution

  • On your custom.js file, this line (~147):

    enter image description here

    window.location.hash = target;
    

    target is not the selector, is a jquery element, so it's an object.

    Change it for this one:

    window.location.hash = target.selector;
    

    I think that's what you want