Friday 12 April 2013

make active link highlight

HI with the use of jquery we can easily do this





<html>
<head></head>
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script>
$(function () {
$(".somelink a").click(function (e) {
e.preventDefault();
$(".somelink a").addClass("active").not(this).removeClass("active");
});
});
</script>
<style>
.active { color:red;}
</style>
</head>
<body>
<ul class="somelink">
<li><a href="#">Sample Anchor</a></li>
<li><a href="#">Sample Anchor</a></li>
</ul>
</body>
</html>

enjoy this ...........

No comments:

Post a Comment