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

前端 未结 3 1919
灰色年华
灰色年华 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:37

    It wouldn't require jQuery, but it's sure easy to do with jQuery.

    $("a").click(function () { 
          $("a").css("color", "blue");
          $(this).css("color", "yellow");
        });
    

提交回复
热议问题