I am trying to implement two JavaScript functions: 1) Displaying a DIV (welcomeDiv) when clicking on a button; 2) Hiding the div by clicking outside of 'welcomeDiv' container.
function showDiv() {
document.getElementById('welcomeDiv').style.display = "block";
}
function hideDiv() {
document.getElementById('welcomeDiv').style.display = "none";
}
While both functions are functional, I am facing an issue where 'welcomeDiv' is being hidden even when clicked inside it, as it is part of the container DIV. To resolve this, I need to disable the hideDiv() function when a click occurs inside 'welcomeDiv'. I have attempted something like:
<div id='welcomeDiv' onclick='hideDiv().disable'>
However, I have been unsuccessful in writing the code correctly despite trying various methods. Any help or suggestions would be greatly appreciated. Thank you in advance.