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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:29:32+00:00 2026-05-26T11:29:32+00:00

Sorry I am quite novice to Javascript. When a page has loaded, I would

  • 0

Sorry I am quite novice to Javascript.

When a page has loaded, I would like to get the active link in a menu.

I can’t compare the current url with the address the points to (links trigger connection within the current page).

The idea is to loop through all the a tags (in a table) and check whether the state of the link is active.
An active link diplays differently by default, so I suppose that there is a way to get this info by querying the element properties.

For the moment I am working round it by checking whether the link diplays as a default active link

if (document.getElementById('MyTable').rows[i].style.fontWeight =="bold"){
    ..some code...
}

This obviously works, but if for some reason the boldness applied regardless of the link status this would fail, so I feel like it is not the most solid method.

I am looking for something like

if (document.getElementById('MyTable').rows[i].cells[0].childNodes[0].active == true){
    ..some code...
}

The childNodes[0] of the first column cell would be the a tag.

  • 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-26T11:29:32+00:00Added an answer on May 26, 2026 at 11:29 am

    You’re much better off doing this server side or alternately google ‘body class CSS navigation’

    And if you’re triggering jumps within the same page just tack on #xyz at the end of the URL and you can compare that in JavaScript.

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

Sidebar

Related Questions

Sorry for asking about quite the same issue, but now i would like to:
Sorry if this has been answered somewhere; I'm not quite sure how to phrase
Sorry if this has been asked elsewhere, I've been looking and can't find it
Sorry if this has been answered before, but all the related questions didn't quite
Sorry for the, strange title, but I couldnt quite get it across. Basically what
Sorry I don't quite get FP yet, I want to split a sequence of
Sorry if you feel like this has been asked but I have read the
I'm quite a newbie in EF, so I'm sorry if my question has been
Sorry if this is quite noobish to you, but I'm just starting out to
Sorry if this is a repost but I couldn't quite search for it because

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.