I am currently working on a Javascript onClick function to toggle the visibility of content in a lengthy table. I initially set part of the table's class to display: "none" and added a button to show the hidden content when clicked. However, nothing is rendering as expected. There are no errors displayed in the console either. Can anyone help identify the issue? Thank you.
function myFunction() {
var button = document.getElementById("button");
var hidden = document.getElementsByClassName("change");
for (var i = 0; i != hidden.length; i++) {
if (hidden[i].style.display === 'none') {
hidden[i].style.display === 'visible';
} else {
hidden[i].style.display === 'none';
}
}};
#dates {
width: 90%;
margin: auto;
margin-top: 50px;
}
table {
width: 100%;
margin: auto;
border-bottom: 1px solid gray;
text-align: left;
}
tr td {
border-top: 1px solid gray;
margin: 5px 10px;
padding: 20px 10px;
text-align: left;
font-size: 1.3em;
}
th {
font-size: 1.5em;
padding: 10px;
}
.change {
display: none;
}
#button {
width: 25%;
padding: 15px;
margin: auto;
text-align: center;
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title> Mystic Mind...</title>
<link href="https://fonts.googleapis.com/css?family=Open+Sans:600" rel="stylesheet">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<link rel="stylesheet" type="text/css" href="css/lightbox.min.css">
<script type="text/javascript" src="css/lightbox-plus-jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="website gallery.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<section class="holder" id="dates">
<div>
<header>Tour Dates</header>
<table>
<tr>
<th>Date</th>
<th>Venue</th>
<th>Location</th>
</tr>
<tr>
<td>August 5, 2018</td>
<td>Parlour</td>
<td>Toronto, Canada</td>
</tr>
// more table data...
</table>
<div id="button">
<button class="btn btn-outline-primary waves-effect" onclick="myFunction()">Past Dates...</button>
</div>
</div>
</section>