document.getElementById("main_btn").addEventListener("click", function (){ hideId("main"); }); //dont call the function directly, use function that calls it