I am using
$(".archived").click(function(){
$(".archivedtable").toggle();
});
I have a bunch of tables that will be opened based on which nav link is selected, so if they select 1, 1 will open. Lets say than they select 2, 2 will open also but 1 is still open. So I was wondering how to make it so 1 would go away and 2 would be the new active one. Does this make sense?
UPDATE:
if ($paid == 1 && $securitylevel == 1 && $csvuser != 1){
$sql = "SELECT firstname, lastname, email, phone, username, password, status, statuschangedate FROM csvdata WHERE memberview =:username ORDER BY lastname";
$sth= $DBH->prepare($sql);
$sth->execute(array(':username' => $username));
$i=0;
echo "<table class='nonothertable'>
<tr class='firsttr' style='background:gray;'>
<td>First Name </td>
<td>Last Name </td>
<td>Email </td>
<td>Phone </td>
<td>Username </td>
<td>Password </td>
<td>Status </td>
<td>Status Change Date</td>
<td>#</td>
</tr>
........
echo "
</table>";
}
<script>
$(".nonother").click(function(){
$(".nonothertable").toggle();
});
</script>
So these tables that are populated by PHP, I have a ton of them and after each one is the script as you see above that will open and close the particular one. I want to know how to, once I click one, if there is another one open that once will close.
They are all in a div, some are nested in another div. All have same parent.
NOTE:
Please note that every single table populated has a different name and different attribute to access it.
ok, for your specific code
just add
before your .toggle();