@foreach($user->endereco as $endereco)
<table class="table">
<thead class="thead-light">
<tr>
<th scope="row">Endereço: {{ $endereco->endereco }}</th>
<th scope="row">Número: {{ $endereco->numero }}</th>
<th scope="row"><small><a onclick="showendereco();" id="{{ $endereco->id }}">Mostrar Tudo</a></small></th>
</tr>
</thead>
</table>
<div class="endereco end-{{ $endereco->id }}" style="display: none;">
<table class="table">
<tbody>
<tr>
<th scope="row">complemento:</th>
<td>{{ $endereco->complemento }}</td>
</tr>
<tr>
<th scope="row">Bairro:</th>
<td>{{ $endereco->bairro }}</td>
</tr>
<tr>
<th scope="row">Cidade:</th>
<td>{{ $endereco->cidade }}</td>
</tr>
<tr>
<th scope="row">Estado:</th>
<td>{{ $endereco->estado }}</td>
</tr>
<tr>
<th scope="row">Ponto de Referência:</th>
<td>{{ $endereco->referencia }}</td>
</tr>
</tbody>
</table>
</div>
@endforeach
I have this address listing, showing only a piece of the address, with a button to show the rest of the data.
I want that when an address is expanded, and if it is clicked on another address, the one that already was expanded enters in hidden and the clicked one is opened.
can have 1 address .. can have 2 .. 5 ... etc .. need to show only 1 when clicked on it.