You can do : $(document).bind('click', function(e){ var $clicked = $(e.target); if (!($clicked.is('#element') || $clicked.parents().is ('#element'))) { //click outside, do what you want :) } else { // click inside, to what you want, or nothing :) } });
that's it ! On 15 jan, 00:14, riotbrrd <k...@riotbrrd.com> wrote: > Hmmm, I wasn't able to find anything about that, though I checked only > quickly. What section fo the docs would that be in? > > On Jan 13, 5:44 pm, Kean <shenan...@gmail.com> wrote: > > > > > > > You might want to look at live and die method now posted in jQuery > > documentation. > > > On Jan 13, 11:32 am,riotbrrd<k...@riotbrrd.com> wrote: > > > > Hi all, > > > > Is there a simple way to capture a click event in a window/document > > > and then determine whether the click was inside an element #foo, or > > > outside of that element? > > > > Thanks! > > > -Kim- Hide quoted text - > > > - Show quoted text -