I have the following list in bootstrap
<i class="fa fa-plus rgh-i" data-toggle="collapse" data-target="#field-1"></i>
<i class="fa fa-plus rgh-i" data-toggle="collapse" data-target="#field-2"></i>
<i class="fa fa-plus rgh-i" data-toggle="collapse" data-target="#field-3"></i>
I use bootstrap to switch the div.
Each html element ihas aria-expanded="true"when I want to show my divs and aria-expanded="false"when I want to hide my div.
I want to check if there are already elements that are aria-expanded="true".. and are there nearby to hide the previous open.
$( "i" ).on( "click", function() {
if(There are elements of that property aria-expanded="true")
{
hide previous item before you open the current one
}else{
}
});
I tried to make a jsdfiddle example, but unfortunately we did it ... I hope you understand what I want to do.
Basically ... I briefly before hiding the previous item to display the next and not be able to open more than one item.
Thanks in advance!