How to stop function from running in javascript, jquery?
<p>I have the following function:</p>

<pre><code>function checkEmails(newEmail){
    $('table td:nth-child(3)').each(function(){
        if ($(this).html() == newEmail)
        {
            alert('The email address "' + newEmail + '" is already in the list.  Duplicates are not allowed.');
            toggleSpinner();
            return false;
        }           
    });
    return true;
} 
</code></pre>

<p>I'm calling it this way in my form submit handler:</p>

<pre><code>if (!checkEmails($('input#email', $('#newForm')).val())) {
  return false;
}//I submit the form via ajax next....
</code></pre>

<p>I'm just checking to make sure that the email address the user's trying to submit isn't already in a table.  It seems to work good, except in Firefox, it doesn't actually stop the ajax request from occurring.  The alert box appears, telling me the user's already in the list, but after clicking ok, the form is submitted anyway.  It works as I want it to in IE.</p>

<p>What am I doing wrong here?</p>
