Here is my code :
<div id="principal" class="classxx">
<div class="class001 cat2 blabla">
<div class="class002">
<div class="class003"></div>
<div class="class004"></div>
<div class="class005"></div>
</div>
</div>
<div class="class001 cat3 blabla">
<div class="class002">
<div class="class003"></div>
<div class="class004"></div>
<div class="class005"></div>
</div>
</div>
<div class="class001 cat1 blabla">
<div class="class002">
<div class="class003"></div>
<div class="class004"></div>
<div class="class005"></div>
</div>
</div>
</div>
I need a function like :
function showOnlyCat(className){}
If I call showOnlyCat('cat3')
I want to see only all the DIVs that have the 'cat3' class (each DIV has multiple classes) and its children of course
And I also need a showAllCat()
that shows all the cat1, cat2, cat3... DIVs
Thank you VERY MUCH for your help
try this :
function showOnlyCat(cat) {
$('div').not('.'+cat).hide();
}
function showAllCat() {
$('div').show();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With