Currently, I have a setup where selecting one div will show its content. However, I am looking to enhance this by allowing multiple divs to be displayed simultaneously. For example, if 'Div 1' is selected and shown, I want the content of 'Div 2' to appear when it's clicked without hiding 'Div 1'. Can anyone provide assistance with achieving this?
HTML
<div class="btn-group" role="group" aria-label="">
<a id="showAll" class="btn btn-primary">Show All Elements</a>
<a class="showSingle btn btn-primary" data-target="1">Div 1</a>
<a class="showSingle btn btn-primary" data-target="2">Div 2</a>
<a class="showSingle btn btn-primary" data-target="3">Div 3</a>
<a class="showSingle btn btn-primary" data-target="4">Div 4</a>
</div>
<div id="div1" class="targetDiv">Lorum Ipsum1</div>
<div id="div2" class="targetDiv">Lorum Ipsum2</div>
<div id="div3" class="targetDiv">Lorum Ipsum3</div>
<div id="div4" class="targetDiv">Lorum Ipsum4</div>
jQuery
$('.showSingle').click(function() {
$('.targetDiv').hide();
$('#div' + $(this).attr('data-target')).show();
$('.btn').removeClass('active');
$(this).addClass('active');
});