How can set the text color to last visited list item?

I want to set the text color to last visited item in list… How can do that???

Keep in mind, this is just HTML, CSS, and JS…simple css pseudo class will do the trick.


I want only for last visited item. Not all visited item.

I have list and list description page. After click on back. On list page should show last visited item with different color(Red).

I have listing and list description. On click of list it will display description. Then, I click back and In listing page i want to set color to item text which i was clicked last.
Please reply…

I would use a service to store the index of the clicked item. When you click, you update the service value. And when you go back to the list, you read that value (and make a comparison in the ng-repeat, if you use that) and set it to null so that it doesn’t color an item the next time you go on the page.

Can you send code. because, i try. that is not working… Please send the code…

I don’t know how you generate your list, but I made a quick codepen:

Thanks. I did that with the help of your code… :slight_smile: