I have a series of tabs that open using the jquery .animate method. They all have the same class names so i am using the .children method to open only the clicked tab.
The problem is i need to close all the other tabs when one opens. I need to target all the tab-inner classes excluding the child of the one clicked.
<div class="tab">
<div class="tab-inner">
</div>
</div>
<div class="tab">
<div class="tab-inner">
</div>
</div>
<div class="tab">
<div class="tab-inner">
</div>
</div>
$('.tab').toggle(function() {
$(this).children('.tab-inner').animate({width: 840});
}, function() {
$(this).children('.tab-inner').animate({width: 60});
});
1 Answer