jQuery unload() Method

jQuery unload() event occurs when the user perform any page away action such as close window, page reload, forward/back buttons etc.


This syntax represent to attach a function on unload event

Parameter Type Description
function Function Optional. Specifies the function to execute when the unload is occurs


This example represent the unload event

<!DOCTYPE html>
  <title>jQuery unload() method</title>
  <script src="jquery-latest.min.js"></script>
        $("div").text("unload event triggered.");
  <img src="../../images/img_nat.png" width="207" height="137" />
  <div>Image loaded successfully.</div>

Run it...   »