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 7974925
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T08:30:57+00:00 2026-06-04T08:30:57+00:00

Link to an anchor within tabbed content from an external link Go to anchor

  • 0

Link to an anchor within tabbed content from an external link Go to anchor. Script needs to be added as a global file across all pages/template. Example of what I have so I have so far.

click on the <a goto="stuff" href="#test">Go to stuff</a> /which goes to the third tab.

jsfiddle

  • 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-06-04T08:30:58+00:00Added an answer on June 4, 2026 at 8:30 am

    The problem is that $(window.location.hash) evaluates to $(‘#test’) so it looks for an element with an ID=”test”. Such element does not exist on your page.

    Using a link like this:

    http://www.canberra.edu.au/media/test/bookmark.html/#test

    would usually indicate that you want to go to content marked with anchor name=”test”.

    In your example I can see at least two anchors with the same name attribute:

    <a name="test"></a>
    

    This is wrong – anchor names must be unique:

    http://www.w3.org/TR/html401/struct/links.html#idx-anchor-4

    So once you fix this and have a unique anchor name, you can then use href instead of your goto attribute.
    It’s also a good idea to use both name and id:

    <a id="test" name="test"></a>
    

    which will make $(window.location.hash) work as expected.

    So now this should activate the correct tab:

    var $targetAnchor = $(window.location.hash);
    tabId = $targetAnchor.closest('.tab-content').attr('id');
    $tabs.find('a[href=#' + tabId + ']').click();
    

    And this should work for scrolling:

    $('html, body').animate({
        scrollTop: $targetAnchor.offset().top
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using Google's smooth scrolling script for a specific anchor link #tothetop and not
I am porting a lot of content from flat file site to Wordpress and
How to add span tag within anchor, changing it from <a href=somewhere.html>Here is the
My intent is to style all anchor tags within a table in a particular
I have an anchor within a div overlaying all the contents of the div.
I would like to extract all img tags that are within an anchor tag
I am trying to grab the link (or href attribute) from an anchor tag
I have a link ( anchor ) tag in a table cell on every
Is this possible if I click on an anchor link to simulate as if
I used the onhashchange event to scroll automatically to an anchor link in a

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.