How to tell onBlur not to hide the submit button when clicked?
<p>My blur event hides the submit button; but doing that seems to cancel the submit event. I only want to hide when the submit itself wasn't clicked.  How can I determine if the focus was lost due to the submit, or due to just wandering off elsewhere?</p>

<pre><code>&lt;form action="" method="post"&gt;
    &lt;textarea id="message" name="message"&gt;&lt;/textarea&gt;
    &lt;input type="submit" id="share" value="Share"&gt;
&lt;/form&gt;
...

$('textarea').blur(function(){ 
     $('#share').hide() 
})
$('textarea').focus(function(){ 
     $('#share').show() 
})
</code></pre>

<p>Setting a timeout to allow the submit event to fire before coming back to the blur seems a bit hacky to me. Can't we do better than that?  Can I tell the blur not to block other events? or search the dom for a pending submit event? or ... ?</p>

<hr>

<p><strong>Solution</strong> </p>

<p>for today is based on the ticked answer, but simpler.  Use jquery's "fadeOut" routine to</p>

<ol>
<li>delay the hidden status of the submit button until after the submit event has fired, and </li>
<li>make the user feel like their submission is being handled</li>
</ol>

<p>.</p>

<pre><code>$('textarea').blur(function(){ 
     $('#share').fadeOut() 
})
$('textarea').focus(function(){ 
     $('#share').fadeIn() 
})
</code></pre>

<p>It's indirect, and not really what I was looking for, but it seems clear that direct manipulation of the event queue - such as writing onBlur to say "if they did not click submit then hide the submit button" - is perhaps not technically possible.</p>
