<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js'></script> <script type="text/javascript"> $(document).ready(function () { $('.header a').click(function () { $('.header').removeClass('active'); $(this).parent().addClass('active'); }); }); </script>
<style type="text/css"> .header { font-size: 16px; width:120px; } .active { background-color: red; } .active a { color:yellow; } </style>
<div class="header"> <ul> <li class="header"> <a href="#">Home</a> </li> <li class="header"> <a href="#">about</a> </li> <li class="header"> <a href="#">contact</a> </li> </div>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)