Browse other questions tagged, Where developers & technologists share private knowledge with coworkers, Reach developers & technologists worldwide, It is working fine. Thanks. You can use mouseleave in your view like this. I like the answer by Sujay. How do I check if an element is hidden in jQuery? I have implemented a solution, but I really do not feel confident with it. it is not possible to express that all popovers should be closed on outside clicks in global configuration. here is the Fiddle i want to close menu with any click outside the parent div . Short story about swapping bodies as a job; the person who hires the main character misuses his body. rev2023.5.1.43405. The accepted answer will throw an error if you click on the button to close the drawer/popup, and the button is located outside of it, because $apply() will be executed twice. Could a subterranean river or aquifer generate enough continuous momentum to power a waterwheel for the purpose of producing electricity? Solution: use Element.closest () inside a document click event listener Element.closest () works its way to the top of the root of the DOM object to see if it can find a match for the query selector that was provided. Extracting arguments from a list of function calls. HTML :