Possible Duplicate:
How to detect a click outside an element?
I have an element on page say “myDiv”
Using jQuery, how do I fire an event which would track a “tap” on any other area apart from “myDiv”
I am saying “tap” as I want to test it on iPad…You can even assume a normal “click” event instead of “tap”…Point is it should be “outside” of “myDiv”
Try binding a click handler to the body element and another click handler to myDiv which stops propagation of the click event. Here’s a jsFiddle demonstrating the concept.