jquery highlight the link when clicked

后端 未结 7 1692
梦毁少年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 23:12

    You can do it using the CSS pseudo-class active. It adds special style to an activated element.

    For example you can do this:

    a: active { color: red; }
    

    Be careful, a:active MUST come after a:hover in the CSS definition in order to be effective!!

提交回复
热议问题