1$(document).on("click", function (event) {
2 // If the target is not the container or a child of the container, then process
3 // the click event for outside of the container.
4 if ($(event.target).closest("#container").length === 0) {
5 console.log("You clicked outside of the container element");
6 }
7});
8