<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>addClass demo</title>
<style>
a {
margin: 8px;
font-size: 16px;
}
.activate {
color: red;
background-color:blue;
}
.highlight {
background: yellow;
}
</style>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
</head>
<body>
<ul>
<li><a href="#">Hello</a></li>
<li><a href="#">world</a></li>
<li><a href="#">Goodbye</a></li>
</ul>
<script>
$(document).ready(function()
{
$("a").click(function () {
$("a").removeClass("activate");
$(this).addClass( "activate" );
});
});
</script>
</body>
</html>