Good day.
How in javascript to "close" a div when clicked outside of this diva?
The same question, just need to write without jQuery .
Good day.
How in javascript to "close" a div when clicked outside of this diva?
The same question, just need to write without jQuery .
This is done, for example, as follows:
document.onclick = function() { document.getElementById("block").style.display = "none"; } function onDivClick(e) { e = e || window.event; e.stopPropagation(); } #block { background-color: #ddf; border: 2px solid #ffd; width: 100px; height: 100px; } <div id="block" onclick="onDivClick(event);"></div> Source: https://ru.stackoverflow.com/questions/540248/
All Articles