I'm trying to toggle the visibility of columns with a click of a button, however the button doesn't seem to be working. Could anyone please help me with this?
The column I'm trying to toggle: {{Kanji}}
function toggleKH() {
var i;
var kcol = document.getElementsByClassName("kanjiColumn");
var hcol = document.getElementsByClassName("hiraganaColumn");
for (i = 0; i < kcol.length; i++) {
if (kcol[i].style.visibility === "visible") {
kcol[i].style.visibility === "hidden";
} else {
kcol[i].style.visibility === "visible";
}
}
}
.kanjiColumn,
.hiraganaColumn {
visibility: visible;
}
<button onclick="toggleKH()">x</button>
<td class="kanjiColumn">{{Kanji}}</td>