Click event was working fine before I tried to use preventDefault() function after document.querySelector(\'#main-page\').style.display=\'block\'; But strangely now it doesn\'t