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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T13:03:26+00:00 2026-05-28T13:03:26+00:00

I created dynamic list(list with hyperlink) using jquery.when I click that link fo rthe

  • 0

I created dynamic list(list with hyperlink) using jquery.when I click that link fo rthe first time it will go to the next page.
I used the cookie for save the index of link value while I am clicking that link.Again run that application
get the saved index value from cookie in onload.Using that value change the color that particular link.
Now I want to I will run that application again that link is displayed in red color and the other links(unvisited) are displayed in blue color.
How to do this?

   $(".sidemenu li ").click(function() {  
              var index = $('li').index(this); 
             // alert(index);
              checkCookie(index);
            // saveid(index);
              });

    }   

    function checkCookie(index)
    {

     var linkindexvalue=index;
     // alert(linkindexvalue);
      setCookie("indexvalue",linkindexvalue,365);


    }

    function setCookie(c_name,value,exdays)
    {
    var exdate=new Date();
    exdate.setDate(exdate.getDate() + exdays);
    var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString());
    document.cookie=c_name + "=" + value;
    alert(document.cookie);
    }
    $(document).ready(function(){

    var list=getCookie("indexvalue");
    if(list=='1'){
    alert(" ");

     $(".sidemenu li").css("background-color","red");

    }

  });

    function getCookie(c_name)
    {
    alert("hj");
    var value = "";
    var DocumentCookie = " " + document.cookie + ";";
    var CookieSearchStr = " " + c_name + "=";
    var CookieStartPosition = DocumentCookie.indexOf(CookieSearchStr);
    var CookieEndPosition;

    if (CookieStartPosition != -1) {
    CookieStartPosition += CookieSearchStr.length;
    CookieEndPosition = DocumentCookie.indexOf(";", CookieStartPosition);
    value = unescape(DocumentCookie.substring(CookieStartPosition, CookieEndPosition));
    }

    return value;

    }  

please guide me.

Thanks in advance

  • 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-28T13:03:27+00:00Added an answer on May 28, 2026 at 1:03 pm

    There’s actually the jQuery Visited plugin that let you get the visited links in your page.

    Once included, you can select the links and attach a class with the new colour:

    $('.sidemenu li a').visited().addClass('visited');
    

    Notice that in this case you have to add an <a> inside your <li>s, since I don’t think the visited feature it’s strictly related to links on a anchor, not clicks on a list item.

    If on the contrary you need to go for the cookies options, give me some time to check your code! 🙂

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

Sidebar

Related Questions

I have created a dynamic list picker script using Jquery 1.3 and PHP that
I have a dynamic view created using jQuery template. The UI is basically a
The scenario...I have a list of dynamic hyperlink controls on an ajax panel that
I created a dynamic list with hyperlinks using Android PhoneGap . Now I want
I created dynamic list using android phonegap application.Now I want to add scrollbar for
I have created an editor template for representing selecting from a dynamic dropdown list
I have created a project in Dashcode, inserted a List control, enabled a dynamic
I'm using this code to be able to generate an dynamic select: demo: http://www.erichynds.com/examples/jquery-related-selects
I have created a search page using parametric filtering conducted on change of checkbox
I'm creating a dynamic expression, which will order items in a list by some

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.