Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6185895
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T01:47:42+00:00 2026-05-24T01:47:42+00:00

the url is as this: http://example.com/download/ var pathname = window.location.pathname; if(pathname==’download/’){ $(#subnav-content div:first).hide(); $(#subnav-content

  • 0

the url is as this: http://example.com/download/

var pathname = window.location.pathname;
if(pathname=='download/'){
$("#subnav-content div:first").hide();
$("#subnav-content div:second").show();
}

why the above code in jquery doesn’t work? i want to when the url is http://example.com/download/. show the secong div.

ps*:does this check affect the site performance?*

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T01:47:44+00:00Added an answer on May 24, 2026 at 1:47 am

    You need the leading slash.

    ‘/download/’

    If you expect query string parameters you may try a regular expression to just match the download portion of the url: the following matches /download/.

    if (window.location.pathname.match(/^\/download\//i))
    

    Regarding the jquery, there is no :second, you need to use :eq(1)

    var pathname = window.location.pathname;
    if(pathname=='/download/'){
    $("#subnav-content div:first").hide();
    $("#subnav-content div:eq(1)").show();
    }
    

    Response to comments

    I’m putting my comment here because the formatting is horrible in the comments. The regular expression for matching download can be summed up as follows:

    / – start of regular expression matching syntax
    ^ – means start matching at the very start of the screen
    \/ – means match the literal string ‘/’, which is a special character which must be escaped
    download – match the literal string ‘download’
    \/ – again means match the literal string ‘/’
    / – end of the matching syntax
    i – regular expression options, i means ignore case

    It was not clear to me what your other note was asking for.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wish to be able to generate URL variables like this: http://example.com/195yq http://example.com/195yp http://example.com/195yg
Is it possible to re-write (Apache Mod-Rewrite) a URL from this: http://www.example.com/view.php?t=h5k6 to this
Take a very simple case as an example, say I have this URL: http://www.example.com/65167.html
I have URL scheme for my blog like this: http://www.example.com/%YEAR%/%MONTH%/%CATEGORY%/%POST_TITLE%/ Now i want to
Is this a valid http url http://www.example.com?x&y or we must always have = sign
i have a url like this http://example.com/blog/photos/photos/gallery/image/1 . And i need to remove the
I have this URL: http://example.com/website/ then I check user country based on geoip and
I have a url formatted like this: http://www.example.com/detail/state-1/county-2/street-3 What I'd like to do is
If I have a URL like this: http://www.example.com/?a=1&b=2&c=3 (an example) I am working on
i want get extension file of url . for example get extension http://www.iranfairco.com/download-file/02912bb889cb24 .

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.