Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I'd say no, there aren't any event of that type. And I don't think there is a perfect way to handle that</p> <p>I'll try to handle it this way</p> <ul> <li>adding a global var, defaulting it to -1 and setting it to 1 when the form get the focus.</li> <li><p>adding a <code>mousedown</code> handler to the document when the form get the focus. It will set a global variable to 1. </p> <ul> <li>When triggered, it'll test if it's still in the form (using <code>event.target</code>). If it's the case, let 1, else set it to 0.</li> </ul></li> <li><p>The <code>mousedown</code> handler will have <code>event.preventDefault;</code> and <code>return false;</code>. <strong>This may cause some trouble to your others eventHandlers</strong>. To avoid such trouble, I'll try to capture the events that could be damaged on the capturing phase, not the bubbling one.</p></li> <li>adding a <code>mouseup</code> handler to the document when the form get the focus. In it, test if the variable has a value of 0. if yes, then do the blur job and remove the two special handlers.</li> </ul> <p>But this might have some weakness (especially if the user leaves the window while the mouse is pressed).</p> <p>I hope this is clear, I'll try to post a fiddle asap.</p> <p><strong>EDIT:</strong> Here is the <a href="http://jsfiddle.net/4WvZk/1/" rel="nofollow">fiddle</a>. However note that I force the focus on the form and it works only one.I did so because it looks like the form never get focused otherwise (probably linked to the way jsfiddle handle events). But in theory that should work without the <code>$("form").focus();</code> line.</p> <p>As a side note, i used jQuery for some shortands I'll try to remove the calls if needed.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload