0
I am making a table and in it will have a visible tr and below a hidden and so on. On the visible tr I put a class 'expandTable' and on the hidden a class 'table'. At the time of clicking instead of opening the corresponding one ends up opening all the hidden ones at once, in jquery I did so
var tabelaOculta = $(".tabelaOculta").hide();
var oculta = false;
$(".expandirTabela").click(function(){
if(oculta == false){
$(this).parent().find(".tabelaOculta").show();
oculta = true;
}else{
$(this).parent().find(".tabelaOculta").hide();
oculta = false;
}
});
and my table
<tr class="expandirTabela">
<td>+</td>
<td>R$ 60.000,00</td>
<td>R$ 15.000,00</td>
</tr>
<tr class="tabelaOculta">
<td colspan="3">
<table>
<tr>
<td>conteúdo oculto aqui</td>
</tr>
</table>
</td>
</tr>
Where are you hiding before calling the onclick event. When loading the page? or in CSS?
– Fabricio
Friend you can use the bootstrap Collapse: https://getbootstrap.com/docs/4.0/components/collapse/, see if this is what you need.
– Leandro Silva Campos
after loading the page
– Juliano Souza