• Share

Outside the element event handler using jQuery

With jQuery outside events you can bind to an event that will be triggered only when a specific “originating” event occurs outside the element in question. For example, you can click outside, double-click outside, mouse-over outside, focus outside (and over ten more default “outside” events). Also, if an outside event hasn’t been provided by default, you can easily define your own.

A basic usage example

Let’s say you have a modal dialog. In addition to a standard “close dialog” button, you want the user to be able to click anywhere outside the dialog to close it. Instead of creating a background overlay that the user must click on, you can just use this plugin!

jQuery outside events

jQuery outside events

Resource: Sample | Tutorial