unload
UK[ˌʌnˈləʊd] US[ˌʌnˈloʊd]
vt. Unload; remove burden; pour; process, dump
vi. To unload goods or other burdens; to unload bullets; [Business] to sell (securities)
jquery unload method syntax
Function:When the user leaves the page, the unload event will occur. Specifically, the unload event is emitted when: A link that leaves the page is clicked. A new URL is typed in the address bar. The browser is closed using the forward or back buttons. The page is reloaded. The unload() method places the event handler in the event handler. Bind to the unload event. The unload() method only applies to window objects.
Syntax: event.unload(function)
Parameters:
Parameters | Description |
function | Required. Specifies the function to run when the unload event is triggered. |
jquery unload method example
<html> <head> <script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ $(window).unload(function(){ alert("再见!"); }); }); </script> </head> <body> <p>当您点击 <a href="//m.sbmmt.com">这个链接</a> 时,或者关闭窗口,会触发一个警告框。</p> </body> </html>
Click the "Run instance" button to view the online instance