lets say i have fallowing html...
<li ><a href="#" id="UsersGuides" ">Users Guides</a></li>
<li ><a href="#" id="Application" ">Application</a></li>
i am adding and removing class by fallowing jquery function...
jQuery('selected').removeClass('selected');
if(!jQuery("#"+selectedAsset).parents('li').hasClass('selected')){
jQuery("#"+selectedAsset).parents('li').addClass('selected');
}
but at the same time i want to add an image at the end of anchor tag, and it should get removed at the same time when i am removing the selected class.i know i can use append method but how to remove it when class get removed, i couldn't not find out. out put should look like in this way...when i clicked on this link
<li class="selected"><a href="#" id="UsersGuides" ">Users Guides</a><img width="10" height="18" src="/search/images/refineSearch-selectedRight.gif" style="position: relative; left: 9px;"></li>
<li ><a href="#" id="Application" ">Application</a></li>
and when i clicked on second link it should like...
<li ><a href="#" id="UsersGuides" ">Users Guides</a></li>
<li class="selected"><a href="#" id="Application" ">Application</a><img width="10" height="18" src="/search/images/refineSearch-selectedRight.gif" style="position: relative; left: 9px;"></li>
how to do this in jquery? Thanks in advance!!!