I have the following code.
I wonna set a css class on the a tag that is clicked. But i wonna do it only in the language div. How can i do that? When i try to do it with $(“language a”) is doesn’t do anything.
<div id="wrapper">
<div id="language">
<a href="#" class="">test 1</a>
<a href="#" class="">test 2</a>
</div>
<a href="#" class="">No div 1</a>
<a href="#" class="">No div 2</a>
</div>
$("a").click(function(event){
$("a.active").removeClass("active");
$(this).addClass("active");
});
.active {font-weight: bold; }
1 Answer