Problem with .show ()

0

Basically I have a jQuery code that should show the widgets on a certain page of my website (their property would be # left, # right) but that is not working and I can not figure out why. Here's the code I'm using:

jQuery(document).ready(function(){
    if(location.pathname=='/forum'){
        jQuery('#left,#right').show()
    }
});

I use to display the widgets only on the page and to hide them from other pages I use this CSS:

#left,#right{display:none}

Could anyone see what's wrong? Thank you in advance.

    
asked by anonymous 09.09.2015 / 14:46

1 answer

1

Change location.pathname by window.location.pathname in your code.

    
09.09.2015 / 14:53