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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T23:22:38+00:00 2026-06-03T23:22:38+00:00

I am hoping there is a way to do this, with one event-handler. Allow

  • 0

I am hoping there is a way to do this, with one event-handler. Allow me to explain:

Considering this simple html snippet that replicates without cruft the idea of what I am dealing with:

<div class="navRow">
     <!-- 5 child divs in here -->
    <div id="box-bambin" class="yellow-box navbox">
    Content 1
    </div>

    <div id="box-mamiepom" class="green-box navbox">
    Content 2
    </div>

    <div id="box-amusailes" class="orange-box navbox">
    Content 3
    </div>

    <div id="box-fracomousse" class="red-box navbox">
    Content 4
    </div>

    <div id="box-pommeEnchantee" class="blue-box navbox">
        Content 5
    </div>

</div>

I had assigned event handler to all inner divs, but I am pretty sure one can just set one event handler on the outer div and capture the events on inner divs. When I set the event handler on outer div .navRow, my mouse captures the outer div event.

  $('.navRow', context).mouseover(function (event, domEle) {      

     var targetBox =  $(event); 

     console.log("captured event target = " + event.currentTarget);

        $('.navRow').each(function(){
            if($(this).attr('id') == $(event.target).attr('id')){
               // Found match do nothing.
              console.log("matched = " + $(this).attr('id'));
            } else{
              console.log("this = " + $(this).attr('class'));
              //* change for image.
            }
        });

  });

At this point I am simply trying to get the inner div that was moused-over. Please, I am very much in need of any critique / hints on bad usage I am doing. Nothing I have tried gives me inner elements #id that was moused-over.

I tried .target and currentTarget properties but they don’t give proper inner div object id.

Is there a way around this, or would all inner objects need to be binded to event handlers?

  • I had a similar piece of code working proper with inner event handlers, just wanted to replicate code behavior, with one single event-handler if possible.

I was thinking this is how bigger applications would work, I mean not having all these event handlers would simplify things somewhat, it seems?

Thanks SO.

  • 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-03T23:22:41+00:00Added an answer on June 3, 2026 at 11:22 pm

    Then use on() (jQuery 1.7+) on the parent for that “single hander”, and siblings() to get the others that are not the target.

    //"attach to .navRow an onmouseover for .navbox"
    $('.navRow').on('mouseover','.navbox',function () {      
    
         //the target. "this" is the DOM element .navbox
         //to use jQuery on it, we wrap it in $();
         var target = $(this);
    
         //the siblings that are not the targets
         //since "target" is already a jQuery object
         //we can use siblings() on it to get its siblings
         var nonTargets = target.siblings(); 
    
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am hoping that there might be an easy way to do this, I
I'm hoping there's a way in a config file or something that will allow
There's a question on this already (here) . But I'm hoping that because I'm
I expect there's one of two answers to this, either impossible or extremely simple
To me they are very similar structures. I was hoping there was a way
I'm hoping there is a better way to the following. I'm creating a jigsaw-type
I am having trouble with the following MYSQL query and are hoping that there
I was hoping some of you guru's out there know the answer to this
I'm new to jquery and am hoping this is a simple issue, but am
Is there a way to somehow hook into the system event of an Application

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.