ドキュメント

Events/unload

From jQuery JavaScript Library

Jump to: navigation, search

« Back to Events

unload( fn )

Binds a function to the unload event of each matched element.
Arguments:
fnFunction
function to bind to the unload event on each of the matched elements.
function callback(eventObject) {
  this; // dom element
}

To display an alert when a page is unloaded:

$(window).unload( function () { alert("Bye now!"); } );