title: Alert not showing before unloading
body: <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
      &lt;head&gt;
           &lt;title&gt;
           &lt;/title&gt;
           &lt;meta charset="utf-8" /&gt;
           &lt;link rel="stylesheet" type="text/css" href="css/custom.css" /&gt;
      &lt;/head&gt;
      &lt;body&gt;
            &lt;a href="http://www.google.co.in"&gt;Google&lt;/a&gt;
      &lt;script type="text/javascript" src="js/jquery-3.1.1.min.js" &gt;&lt;/script&gt;
      &lt;script type="text/javascript" src="js/custom.js" &gt;&lt;/script&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>below is code in <code>custom.js</code></p>
  
  <pre><code>$(window).on('beforeunload',function (){
       alert("abc");
  });
  </code></pre>
  
  <p>I want the page to show an alert before going to next page after clicking the link, but it is not showing.</p>