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).
<
This should work:
Javascript:
$(function(){
$('.class1').click(function() {
$(this).toggleClass('active1');
});
});
CSS:
a.class1 { color: red; }
a.active1 { color: blue; }
HTML:
some text
Its better to use toggleClass (2 in 1) instead of addClass/removeClass.