Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6476561
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:50:24+00:00 2026-05-25T06:50:24+00:00

I am listening for a blur event on a form input. Right now, the

  • 0

I am listening for a blur event on a form input. Right now, the event immediately gets triggered when the mouse is pressed down outside of the control. I need to be able to detect when the mouse is completely clicked outside of the input (mouse down and then mouse up).

Is there already an event type that I can listen to that will handle this? If not, what is the best way to handle this type of event?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T06:50:25+00:00Added an answer on May 25, 2026 at 6:50 am

    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

    I’ll try to handle it this way

    • adding a global var, defaulting it to -1 and setting it to 1 when the form get the focus.
    • adding a mousedown handler to the document when the form get the focus. It will set a global variable to 1.

      • When triggered, it’ll test if it’s still in the form (using event.target). If it’s the case, let 1, else set it to 0.
    • The mousedown handler will have event.preventDefault; and return false;. This may cause some trouble to your others eventHandlers. To avoid such trouble, I’ll try to capture the events that could be damaged on the capturing phase, not the bubbling one.

    • adding a mouseup 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.

    But this might have some weakness (especially if the user leaves the window while the mouse is pressed).

    I hope this is clear, I’ll try to post a fiddle asap.

    EDIT: Here is the fiddle. 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 $("form").focus(); line.

    As a side note, i used jQuery for some shortands I’ll try to remove the calls if needed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a user control that is listening to an event. public partial class
I have a udp client that is listening for multicast messages. When it gets
After listening to Rails Cast No 190 I sat down to try it So
I'm listening for keypress events on an input field with delegation. For some reason,
I am listening to the change event of a select dropdown using jquery and
I'm currently listening to a form submitting on one of my views and it's
There are 24 div-objects waiting/listening for a mouse-click. After click on one div-object, I
In listening for key events in ActionBarSherlock in order to show the overflow menu
I was listening to a podcast recently (may have been SO - can't remember)
How to register listening for any Contact (add/remove contact, change in email/phone ) changes

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.