Webdev,
<!DOCTYPE HTML>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
<style type="text/css">
.red {
background: red;
}
.green {
background: green;
}
.blue {
background: blue;
}
.yellow {
background: yellow;
}
.maroon {
background: maroon;
}
a{
width: 50px;
display: inline-block;
}
</style>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script>
$(function ()
{
var cls = 'red', indx = 0, $a = $('.main-nav a');
$a.click(function ()
{
var temp = this.className;
$a.eq(indx)[0].className = temp;
this.className = 'red';
cls = temp;
indx = $a.index(this)
}
)
}
)
</script>
</head>
<body>
<nav>
<ul class="main-nav">
<li><a class="red" href="#navTab1">1</a></li>
<li><a class="green" href="#navTab2">2</a></li>
<li><a class="blue" href="#navTab3">3</a></li>
<li><a class="yellow" href="#navTab4">4</a></li>
<li><a class="maroon" href="#navTab5">5</a></li>
</ul>
</nav>
</body>
</html>