Fix uncaught error when the click is on the HTML element