I am working on 'OnClick' functionality in jQuery. When we click parent Div property, only parent div and its child divs should be displayed other divs should fade out.
Please find the code below. HTML:
<div>1</div>
<div class="ree">2</div>
<div class="foo">items
<div class = "bar">Shoes
<div class="nike">3</div>
<div class="puma">5</div>
<div class="gap">5</div>
</div>
</div>
<div>4</div>
jQuery:
$('.foo').on('click',function ()
{
$('div:not(.foo)').css('opacity','0.2')
});
Here When I click on Div Class 'foo', Except 'foo' and its child divs like bar,nike,puma,gap div classes should be displayed and all other Div classes should fade out.
Please find the demo below,
Thanks all