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

前端 未结 3 1985
灰色年华
灰色年华 2021-01-02 07:15
a:link {color:#FF0000} /* unvisited link */
a:visited {color:#00FF00} /* visited link */
a:hover {color:#FF00FF} /* mouse over link */
a:active {color:#0000FF} /* se         


        
3条回答
  •  清歌不尽
    2021-01-02 07:58

    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");
    });
    

提交回复
热议问题