title: Showing a jQuery popup before browser window closes
body: <p>I'm using the following js to show a popup before the browser/window closes. But it does not seem to be working.     </p>
  
  <pre><code>$(window).bind('beforeunload', function(e) {
      $('#beforeclose').click(); 
  });
  </code></pre>
  
  <p>The popup i'm trying to show is <a href="http://www.no-margin-for-errors.com/projects/prettypopin/" rel="nofollow">prettyPopin</a> . And the <code>#beforeclose</code> is the id of the anchor with which i'm trying to bind the click event before the window unloads. I have noticed that native js popups work but the jQuery popup does not work.</p>
  
  <p>Is there a way to achieve what i want to? Please do explain to me or refer me to the respective link because i'm not an expert at js.</p>
  
  <p>Thanks in advance.</p>