Alex Rivera | Logout

How to set the last-clicked anchor to be a different color from all other links?

Asked 2009-07-19T23:25:30.537
12
a:link {color:#FF0000} /* unvisited link */
a:visited {color:#00FF00} /* visited link */
a:hover {color:#FF00FF} /* mouse over link */
a:active {color:#0000FF} /* selected link */

The pseudo-classes (link, visited, hover, active) don't do exactly what I want which is to highlight the last-clicked link on a page to be a different color from all of the other links on the page.

Would this require JQuery and, if so, any suggestions?

Edit
Report

1 Answer

6

You definitely can't do it with css.

With jQuery you could do something like

$("a").live("click", function() {
    $("a").removeClass("yourHighlightClass");
    $(this).addClass("yourHighlightClass");
});
answered 2009-07-19T23:28:39.050

Your Answer