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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:15:21+00:00 2026-05-25T16:15:21+00:00

I have link like this: http://localhost/BandTemplate/admin/galleries How can I get to the last segment

  • 0

I have link like this:

http://localhost/BandTemplate/admin/galleries

How can I get to the last segment (galleries) with jquery so that I can change menu tab to active. This is code for the menu:

  <nav id="navigation" class="col_12">
<ul>
    <li><a href="<?php echo base_url() ?>admin">Home</a></li>
    <li><a href="<?php echo base_url() ?>admin/band">Band</a></li>
    <li><a href="<?php echo base_url() ?>admin/news">News</a></li>
    <li><a href="<?php echo base_url() ?>admin/discography">Discography</a></li>
    <li><a href="<?php echo base_url() ?>admin/tour">Tour</a></li>
    <li><a href="<?php echo base_url() ?>admin/galleries">Galleries</a></li>
    <li><a href="<?php echo base_url() ?>admin/social">Social Networks</a></li>
    <li><a href="<?php echo base_url() ?>admin/messages">Messages</a></li>
    <li><a href="<?php echo base_url() ?>admin/logout">Logout</a></li>
</ul>

  • 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-25T16:15:22+00:00Added an answer on May 25, 2026 at 4:15 pm

    A more elegant solution would be to traverse the UL list and check if A href attribute has the same URI value as the current page, if yes, add class “active” to LI elem and break the loop.

    $(function() {
     $('#navigation ul').children().each(function() {
       var link = $(this).find('a');
       if ($(link).attr('href') == location.href) {
         $(link).addClass('active');
         return false;
       }
     });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using C# & Java Script I have the link like this http://localhost/Server/Vehicle/Vehicle.aspx?appid=5 , when
I have a CSS link that looks like this: <link href=../../css/WW/parts.css type=text/css rel=stylesheet />
Hi I have an action link placed on http://localhost:1338/Tags/InternalTag/Test which I would like it
I have a URL like this: http://localhost:9001/view/shopindex/display?keyword=test&searchPostcode=Postcode and I'm putting it in the body
I want to configure Kohana 2.x to have links in this format: http://localhost/mysite/web/admin/support instead
I have a flash file (full link to flash looks like http://localhost:8888/PROJECT/swf/audio/player.swf ) which
I have found some info on the subject ( like this link) , but
I have HTML code like this : <div> <a>Link A1</a> <a>Link A2</a> <a>Link A3</a>
I have some markup like this: <p><a id=1 href=#>Link 1</a></p> <p id=1show class=starthidden>Hi! I
I have a html like this: <html> <head> <link rel=stylesheet type=text/css media=all href=style.css> </head>

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.