1
I need to make a function that when clicked only the div with the passed class is visible and the others are hidden.
<a href="javascript:teste('minhaDiv');" class="expander">Link</a>
<a href="javascript:teste('minhaDivo');" class="expander">Link</a>
<div class="container">
<div class="minhaDiv" style="display: none">Div que aparece e some</div>
<div class="minhaDiv" style="display: none">Div que aparece e some</div>
<div class="minhaDiv" style="display: none">Div que aparece e some</div>
<div class="minhaDivo" style="display: none">Div que aparece e some</div>
<div class="minhaDivo" style="display: none">Div que aparece e some</div>
</div>
function teste(div){
$('.container').each(function() {
if($(this).attr('class') = div){
$(this).show();
}else{
$(this).hide()
};
});
}
That code of yours doesn’t work ?
– Mauro Alexandre