jQuery / Javascript - Show / hide ID if current url contains /foo/

javascript, jquery

Solution

I think he wants to hide an element if the URL contains that part.

if (/\/blah\//.test(window.location)) {
    $('#element').hide();
}

Problem

I am using jQuery currently and I am looking for a way to hide if the url contains /blah/. Thanks in advance for your help. I am a js Noob and know it can be accomplished with regex somehow but don't have the time to learn this right now. I have a deadline I need to meet! Thanks, Jack

Original source