Malek Ben Halima Malek Ben Halima - 7 months ago 13
Javascript Question

Hide and show another table in the same section with back button

I have a section containing a table.
I want to hide the table whenever an element in that table is being clicked and show another table in the same without reloading the page.
I want also to show a back button so I can return to the initial section.
Thanks

<section class="tabs" id="content3">
<table class="rwd-table">
<tr>
<th>Livre</th>
<th>Article de journal</th>
<th>Chapitre de livre</th>
<th>Conférence avec actes</th>
</tr>
<tr>
<td data-th="Livre"> <a href ="#">2008</a></td>
<td data-th="Article de journal">CESACO 2012-2015</td>
<td data-th="Chapitre de livre">M-Trace 2010-2013</td>
<td data-th="Conférence avec actes">M-Trace 2010-2013</td>
</tr>
<tr>
<td data-th="Livre">RSE 2010-2013</td>
<td data-th="Article de journal">CESACO 2012-2015</td>
<td data-th="Chapitre de livre">M-Trace 2010-2013</td>
<td data-th="Conférence avec actes">M-Trace 2010-2013</td>
</tr>




Answer

If you aren't clear in your question we can't give clear answers. Just use hide() to hide the clicked table. Use show() to show the table/button that have to be shown.

$('#table1').on('click', function(){
$(this).hide();
$('#table2').show();
$('#backbutton').show();
});
Comments