Reputation: 2869
I just can't get the clicked link to change class and show as active link
See fiddle: http://jsfiddle.net/kAW4g/
$(".navul a").on('click', function(e) {
$(this).addClass("navhover");
});
What am I doing wrong?
Upvotes: 0
Views: 131
Reputation: 337743
The jQuery code works, the issue is that your CSS rule is not specific enough to override the default background-color
, try this:
.navul a.navhover { // <--more specific selector
color: blue;
background-color: #6eff97;
}
Also, your fiddle was not working because you did not include jQuery in the page via the dropdown on the left.
Upvotes: 7