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

  • SEARCH
  • Home
  • 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 902555
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T15:44:09+00:00 2026-05-15T15:44:09+00:00

Given the sample markup: <div> <input /> <input /> <input /> </div> How can

  • 0

Given the sample markup:

<div>
    <input />
    <input />
    <input />
</div>

How can one, via jQuery, determine that div has lost focus?

I can use focusout() but that’s not quite what I need. With focusout, it will get triggered as one tabs from input to input, as it’s actually detecting (via event bubbling) that the input is losing focus.

Another way to word the requirement: I need to know when focus has moved OUTSIDE of the div.

I asked a similar question before:

jquery focusin() and preventing bubbling

But that was related to a pop-up UI and one can get around that by inserting a blank DIV behind it and putting a click/focus event on that as a trigger but that’s won’t work for this situation.

The next thought I had was to test for focusin when calling focusout:

    $(".myobject").focusout(function(element) {
    if(!($(this).focusin())){
        console.log('doYourThing ' + $(this));
    }
});

Alas, that doesn’t work (I’m guessing due to the fact that it’s evaluating focusin during the focusout event and, as such, it hasn’t detected focusin yet.

Any clever solutions to this problem? Am I maybe missing a native jQuery event that does exactly what I’m looking for?

UPDATE:

Actually, the simplified question:

I need the equivalent of $('div').blur() but that would actually work on a div (since blur can’t be triggered from a div)

  • 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-15T15:44:10+00:00Added an answer on May 15, 2026 at 3:44 pm

    Well, what might work would be to bind a “focus” handler to everything, and you know when you’re not in the <div> when you get a “focus” event elsewhere.

    $('body').live('focus', (function() {
      var inDiv = false;
      return function(e) {
        if ($(this).closest('#theDiv').length)
          inDiv = true;
        else {
          if (inDiv)
            alert("just lost focus!");
          inDiv = false;
        }
      };
     });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ive been writing a simple jquery function that turns a div with a list
Has anyone run perl script given at http://oreilly.com/pub/h/974#code ? This is a famous one,
Here's a simple example to illustrate the behavior: Given this html markup: <div data-company=Microsoft></div>
Given a simple C# class definition like: [System.Windows.Markup.ContentProperty(PropertyOne)] public class SimpleBase { public string
Given the sample console application below: QUESTION #1 : Why does .Name() return typeof
Given this sample code: #include <iostream> #include <stdexcept> class my_exception_t : std::exception { public:
Given the sample code: class Base { public: bool pub; protected: bool prot; };
I've had a look at the metronome sample given by Apple, however, the sample
Please see the sample xml given below. As per a requirement, I need to
Given the following code sample: uint8_t i, in, ni; i = in = 2;

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.