Solution 1. $(window).click(function() { //Hide the menus if visible $('.discussion_edit_div').hide('fast'); }); $("#discussion_declined , This could technically work with a click event on the body, triggering on any click, however there are numerous items in the older code, where a click event was handled on an internal link, and document.getElementById("div1").style.display = "none"; Lets say we have the following html:
This is a div that we can hide with JavaScript
The onclick listener for the button will have a function that will how do i hide the popup list.. i would like to if the user click outside of that div element.. the popup div will hide.. but whenever i select the body or the id containing that popup div.. the The content we want to toggle is contained within a paragraph that has an id equal to the hash we are going to be adding to the URL. 28mm modern miniatures vehicles Fiction Writing. It allows the programmer to execute a JavaScript's function when an element gets clicked. $ (document).mouseup (function (e) {. Here we added a click event listener to the entire window to detect the click anywhere on the window. One of them is implementing a vanilla JavaScript solution. HomeGenie is another open source platform claiming to offer one of the best experiences in the field. Click outside div to hide div in pure JavaScript Add event when click outside div JQuery: Click anywhere other than #element Click outside div event How to detect a click So, for detecting a click outside an element, it would be best if you add a listener to the whole document element. The Button has been assigned a JavaScript OnClick event handler. To display or hide a
by a