list of link. required when we click it changes its color i.e highlight active link…
I can’t use css as this page is not refreshing. Want to highlight current link.
HTML
<table border="0">
<tr style=" width: 100px;">
<td>
<div class="overMe">
<a href="javascript:void(0);" class="leftList">link 1</a>
</div>
</td>
</tr>
<tr style=" width: 100px;">
<td>
<div class="overMe">
<a href="javascript:void(0);" class="leftList">link 2</a>
</div>
</td>
</tr>
<tr style=" width: 100px;">
<td>
<div class="overMe">
<a href="javascript:void(0);" class="leftList">link 3</a>
</div>
</td>
</tr> </table>
CSS
a {
color: darkgreen;
}
.selected {
color: red;
}
jQuery Code
$(document).ready(function(){
$('.overMe a').click(function(){
$(this).addClass('selected');
$('.overMe a').siblings().removeClass('selected');
});
})
EXAMPLE : http://jsfiddle.net/TL9rh/
Use
.not(this):Example: http://jsfiddle.net/Curt/TL9rh/65/