in advance thank you for your time, I have a problem with a table in which I use collapse, when I click on a row I display the information, but when I click on another, the last row that is moved does not return to its place. This is my PHP code.
if ($resultado->num_rows>0) {
$salida.="<table class='table table-condensed'>
<thead>
<tr id='titulo'>
<th scope='col'>Menu</th>
<th scope='col'>precio</th>
</tr>
</thead>
<tbody>";
while ($fila = $resultado->fetch_assoc()) {
$salida.="<tr data-toggle='collapse' data-target='#demo".$fila['ID']."'>
<td scope='row'>".$fila['nom_com']."</td>
<td>$".$fila['precio_com']."</td>
</tr>
<tr>
<td colspan='6' class='hiddenRow'>
<div id='demo".$fila['ID']."' class='collapse'>".$fila['descr_com']."</div>
</td>
</tr>";
}
and it is assumed that with this JS code you can hide the other tables that do not have the focus but I do not know what I'm doing wrong.
$('.collapse').on('show.bs.collapse', function () {
$('.collapse.in').collapse('hide');
});
If it serves you more here, take out the code