Hi guys,
I have the following structure :
<ul id='myTopicsList'>
<li>
<a><span> First Element </span></a>
</li>
.....
</ul>
The first time the page is loaded the first li will be selected by highliting it to background color blue.
The next time the user clicks another element in the list it should change to blue and the rest should have white background.
I am using this script :
function GetMyTopic(catID) {
$('#myTopicsList li').each(function () {
if ($(this).attr('id').indexOf(catID) > 0) {
$(this).addClass('SideBarBoxliSelected');
}
else {
$(this).addClass('SideBarBoxli');
}
});
}
here the css :
.SideBarBoxli{margin-bottom:4px; background-color:#fafafa; height:22px; }
.SideBarBoxli:hover {background-color:#E3ECF8; cursor:pointer; }
.SideBarBoxliSelected{margin-bottom:4px; background-color:#6388BF; height:22px; }
When I click and assign the SideBarBoxliSelected class to the cliked li the background remains the same.
Any suggestions?