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 8432561
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T06:09:37+00:00 2026-06-10T06:09:37+00:00

I have a div on a page that shows some information about a particular

  • 0

I have a div on a page that shows some information about a particular category (Image, Name, etc).

When I click on the edit image, it puts the category into edit mode which allows me to update the name. As you can see from the image below, it shows that "Soup" is currently in edit mode, and the others are in normal view mode. This all works as expected with the Cancel / Save buttons doing everything right. (I tried adding an image, but it wouldn’t let me, and it needs more love.)

However, once in edit mode, if I click anywhere else on the page (Outside of the div), the expected result would be that the soup category would go back to view mode. Upon an event firing of some sort, this should also allow me to ask if they wanted to save changes.

So then I decided to create a blur event on the "soups" parent div. This works as expected if I click anywhere on the page. However, if I click on the inner element of the div, it also causes the parents blur event to be fired, thus causing the category to go back to view mode.

So, is there a way to prevent the parent div from firing the blur event if any one of its children receive focus?

<div tabindex="-1" onblur="alert('outer')">
    <input type="text" value="Soup" />
</div>

I just wrote the code without a compiler, so I am not sure if that even works, but with that, hopefully you get the idea.

I’m using Knockout.js to update the GUI on the fly, but that shouldn’t affect this answer I wouldn’t have thought.

  • 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-06-10T06:09:39+00:00Added an answer on June 10, 2026 at 6:09 am

    I’ve had to tackle this problem before. I am not sure if it is the best solution, but it is what I ended up using.

    Since the click event fires after the blur, there is no (cross-browser, reliable) way to tell what element is gaining focus.

    Mousedown, however, fires before blur. This means that you can set some flag in the mousedown of your children elements, and interrogate that flag in the blur of your parent.

    Working example: http://jsfiddle.net/L5Cts/

    Note that you will also have to handle keydown (and check for tab/shift-tab) if you want to also catch blurs caused by the keyboard.

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

Sidebar

Related Questions

I have a page ItemList that shows a list of items using div's. After
I have a div (sub area of page with scroll bar) that has some
I have some JQuery code that shows or hides a div. $(div#extraControls).show(); // OR
I have a page that consists of a header div for navigation, a content
I have a page that has a gif animation in a hidden div. Upon
I have an ASP.NET page that contains two div's. Both have search fields and
I have an HTML page that roughly looks like this: <div id=rolesRollerBody style=height: 309px;>
I have an ASP.Net page that contains a <div> with an <img> tag within.
The Idea I have a main PHP page that loads content in DIV's from
I have a div that covers the entire page width=100% and height=100% . I

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.