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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T00:24:07+00:00 2026-06-06T00:24:07+00:00

<div id=content-container> <ul> <li id=link1><a href=http://mysite/ClassifiedPrograms/Pages/Training1.aspx>Training1</a></li> <li id=link2 ><a href=http://mysite/ClassifiedPrograms/Pages/Training2.aspx>Training2</a></li> <li id=link3 ><a href=http://mysite/ClassifiedPrograms/Pages/Training3.aspx>Training3</a></li>

  • 0
<div id="content-container">
<ul>
<li id="link1"><a  href="http://mysite/ClassifiedPrograms/Pages/Training1.aspx">Training1</a></li>
<li id="link2" ><a  href="http://mysite/ClassifiedPrograms/Pages/Training2.aspx">Training2</a></li>

<li id="link3"  ><a href="http://mysite/ClassifiedPrograms/Pages/Training3.aspx">Training3</a></li>
<li id="link4" ><a href="http://mysite/ClassifiedPrograms/Pages/Training4.aspx">Training4</a></li>

</ul>
</div>

When any link is clicked, onclick of that link should change the parent li id and make it clickedlink1 if link1 was clicked. How do i do that in jquery?

  • 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-06T00:24:08+00:00Added an answer on June 6, 2026 at 12:24 am

    Changing the class of the li when the link is clicked will not necessarily help here as that will reset as soon as the new page loads.

    You could instead use this:

    $("a:visited").parent("li").addClass("is_visited");
    

    Which will add the class “is_visited” to any li where the link has been visited.

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

Sidebar

Related Questions

when loading content via ajax requests, If the response is: <div id=container> <a href=http://www.google.com>To
<a id=submit_signup class=submit-button button-link href=> <div class=button-container> <div class=button-left></div> <div class=button-content>Log in</div> <div class=button-right></div>
The page has a container div which holds multiple content divs. Each content div
I have three divs, within a content div. Container width 70%. Within that I
I have a container div (red) with a top padding of 400px. The content
<div id=container> some content </div> Say the container div is resizable, while resizing how
This is my code : HTML: <div id="container"> <div id="box"> Content </div> </div>​ CSS:
<a href=#tab1>Tab1</a> <div id=tab1>content</a> ... var a = $(this).attr('href'); $(a).show(); This works but only
I have two div containers with content in them and two buttons outside the
I have a wrapper div that contains arbitrary content (I don't know its length).

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.