I wrote a basic toggle function that I have used before but for some reason it is not entirely working. The reason I say that is because when I console log the display it says the display is none but the element never disappears. I know for a fact that the function is firing and that it detects the elements display as "", however it sets it to none (and logging that to the console proves it) but the actual element does not disappear from the screen.
function filter_toggle(){
var form = document.getElementById("filter_form");
var display = form.style.display;
console.log(display);
if (display == ""){
display = "none";
}
else if (display == "none"){
display = "";
}
}
<div id="filter_wrap">
<div id="filter_toggle" class="basic_toggle" onclick="filter_toggle()">--Filter--</div>
<div id="filter_form" class="bg-1D1D1D">
...more elements...
</div>
</div>
display = form.style.display-var displayis a String, which has a copy of the value that is inform.style.displayconsole.log()also won't log anything as you aren't passing anything to it. Tryconsole.log("display", display)