Как я могу изменить этот код, чтобы кнопки изменились на активное. Это происходит с помощью toggleClass, но кнопка, которая ранее была активной, остается активной.Показать скрыть div с активным состоянием
<script type="text/javascript">
jQuery(function(){
jQuery('#showall').click(function(){
jQuery('.targetDiv').hide();
});
jQuery('.showSingle').click(function(){
jQuery('.targetDiv').hide();
jQuery('#div'+$(this).toggleClass("greenactive"
).attr('target')).show();
});
});
</script>
мой код кнопки
<ul class="choose">
<li><a class="showSingle" target="1">Email Order</a></li>
<li><a class="showSingle" target="2">Order and Pay Now</a></li>
</ul>
дивы
<div id="div1" class="targetDiv" style="display:none">
content
</div>
<div id="div2" class="targetDiv" style="display:none">
content
</div>
стиль
a.greenactive {background:green}