Easy Tutorial
❮ Sel Header Sel Even ❯

jQuery unload() Method

jQuery Event Methods

Example

Display a prompt message when leaving the page:


Definition and Usage

The unload event occurs when the user leaves the page.

The unload event is triggered in the following situations:

The unload() method specifies what happens when the unload event occurs.

The unload() method is only applicable to the window object.

Note: The unload event behaves differently across browsers. Ensure to test this method in all browsers before use.


Syntax

Parameter Description
function Required. Specifies the function to run when the unload event is triggered.

jQuery Event Methods

❮ Sel Header Sel Even ❯