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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T08:19:18+00:00 2026-06-05T08:19:18+00:00

<div id=parent> <div id=children> </div> </div> And if we bind both parent and children

  • 0
  <div id="parent">
    <div id="children">
    </div>
  </div>

And if we bind both parent and children with same events like :

     $("#parent").live({ mouseenter : Infocus , mouseleave : Outfocus });
     $("#children").live({ mouseenter : Infocus , mouseleave : Outfocus });

Now my problem is when i get my mouse over to the children the parent is also highlighted, Can anybody tell me whats going on here?

  • 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-05T08:19:18+00:00Added an answer on June 5, 2026 at 8:19 am

    You’ve to use stopPropagation() for prevent event follow.

    function Infocus(e) {
      e.stopPropagation();
      // your code
    }
    
    function Outfocus(e) {
      e.stopPropagation();
      // your code
    }
    

    Read about .stopPropagation()

    You can do something like this: (may be not satisfactory)

    $("#parent").live({
        mouseenter: Infocus,
        mouseleave: Outfocus
    });
    $("#children").live({
        mouseenter: Infocus,
        mouseleave: Outfocus
    });
    
    function Infocus(e) {
        if(this.id == 'parent') {
            $(this).css('background', 'yellow');
        } else if(this.id == 'children') {
            $(this).css('background', 'green');
            $(this).parent().trigger('mouseleave')
        }
    }
    
    function Outfocus(e) {
        if(this.id == 'parent') {
            $(this).css('background', 'transparent');
        } else if(this.id == 'children') {
            $(this).css('background', 'transparent');
            $(this).parent().trigger('mouseenter')
        }
    }
    

    DEMO

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

Sidebar

Related Questions

$(this).parent().parent() .children(this.attr(tagName).toLowerCase()) .css(background-color, yellow); xpath: /html/body/div/table/tr/td/b/a $(this).tagName is Anchor <a> the problem with this
I've got a layout like this: <div id='parent'> <div id='row_0'></div> <div id='row_1'></div> <div id='row_2'></div>
How to make parent's div height auto increment depending on its children' maximum height?
I want to integrate .live() into this function: $('a.oembed').each(function(){ $(this).embedly({maxWidth:400,'method':'replace'}).bind('embedly-oembed', function(e, oembed){ $(this).parent().append($(<img>, {
When a parent div has a css drop-shadow applied, and its children is animated
I have the following HTML and I need to get the first div parent
Consider my parent div is parentDiv and it contains five child divs <div id=parentDiv>
Here is my parent div, <div id=ResultsDiv class=resultsdiv> <br /> <span id=EmployeeName style=font-size:125%;font-weight:bolder;>Pandiyan</span> <span
i use a parent div with three child divs , <div id=parentDiv> <div id=PagerUp
I thought a parent div automatically scales according to the content inside it. For

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.