jquery highlight the link when clicked

后端 未结 7 1750
梦毁少年i
梦毁少年i 2021-01-14 22:41

How do I use jquery to highlight the link when I click on it?

For example, when I click on the link class1_1, I want to make this link red (or another color).

<
7条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-14 22:56

    Think this should do it, although I don't have jquery on hand right now. Assumes 'up' is a class that makes your link red:

    $("ul#menu a").click(function(){
     $(this).addClass('up');
    });
    

提交回复
热议问题