Listening for HTML navigation events - Javascript jQuery Method and Property

Javascript examples for jQuery Method and Property:on

Description

Listening for HTML navigation events

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript" src="https://code.jquery.com/jquery-compat-git.js"></script> 
      <script type="text/javascript">
    $(window).on('load', function() {
$(window).on("beforeunload", function() {
    return "This is a jQuery version";
});/*from   www  .  j  av  a  2s.co  m*/
    });

      </script> 
   </head> 
   <body> 
      <!-- try navigating away from this page -->  
   </body>
</html>

Related Tutorials