title: How to "catch" and on unload event when doing an onblur
body: <p>I have an application which when a user enters a field it then performs an AJAX validation on the field they have entered. This is triggered using an <code>onblur</code> trigger on the field. However, I want to be able to stop this firing when the user is actually navigating away from the page.</p>
  
  <p>My input field looks something like</p>
  
  <pre><code>&lt;input type="text" onblur="checkIt(this.value);" id="name" /&gt;
  </code></pre>
  
  <p>where the checkIt function just calls an AJAX process to validate the input. If the input is invalid then it returns an error, which is displayed in a DIV on the page. This all works great except that if the user changes their mind and decides to navigate away from the page, the error div is still displayed before they navigate away.</p>
  
  <p>So in my checkIt function I want to some how be able to say,</p>
  
  <p>If <code>event = unload</code> page then don't show the error and allow user to navigate away.</p>
  
  <p>I am using Oracle APEX, so have <code>javascript</code> or <code>JQuery</code> available to do this</p>
  
  <p>Any ideas?</p>