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

  • Home
  • SEARCH
  • 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 6363931
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T00:05:59+00:00 2026-05-25T00:05:59+00:00

I have a simple site where each page is actually a section . The

  • 0

I have a simple site where each “page” is actually a section. The sections are layered on top of each other using position:absolute and z-index; when a navigation item is clicked, the section with an id matching the class name of the navigation item is promoted to the top of the stack, changing the “page”.

What’s got me stuck now, though, is figuring out how to target a particular section from a link within the content of another section. I know the gist of what I have to do, but I’m lost as far as the execution goes.

How I imagine it needs to go is this:

$('section a[href^=#]').click(function(){
                var target = $(this).attr(href).(strip the hashtag from the beginning of the link and output the resulting value);
$('body').find('section[id='+target+']').addClass('active').css('z-index', '2')
$('body').find('section[id!='+target+']').removeClass('active').css('z-index', '1')
                });

I imagine this involves RegEx somehow, which I know nothing about. Any thoughts?

  • 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-25T00:06:00+00:00Added an answer on May 25, 2026 at 12:06 am

    No need for regexen: the underlying DOM object for links exposes the Location interface, which gives you direct access to the parts of the URL as definitively parsed by the browser itself. The hash property holds the anchor part including leading #, so slice that one character off:

    this.hash.slice(1);
    

    Or even, since you can reuse the # for an ID selector:

    $(this.hash).addClass...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple Tray icon program that opens a site using System.Diagnostics.Process.Start(URL) And
I have this simple click limit for my site using sessions, I would just
So I have a simple voting feature on my asp.net mvc page. My index
I have made a simple auction section on my site, and I would like
I have a simple ASP.NET 4 site. I am using Forms Authentication. I have
I have an individual file for each page on my site, which contains a
I have a simple three page asp.net webforms site and having an issue with
I have a list of URLs, each page is a specific category: http://www.site.com/category-1/page.html http://www.site.com/category-2/page.html
Imagine that you have a simple site with only 2 pages: login.aspx and secret.aspx.
We have a rather simple site (minimal JS) with plain html and CSS. It

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.