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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T02:19:56+00:00 2026-05-16T02:19:56+00:00

I can’t stop the stupid thing from firing off an event when hovering over

  • 0

I can’t stop the stupid thing from firing off an event when hovering over the children of item.
I only want the event to fire via the div.item element, not the div.itemChild. This is driving me nuts please help.

event.stopPropigation does not work. nor does if(!$(event.source).is('itemChild')), for some reason is() alway returns false.

HTML

<div id="items">
    <div class="item">
        <div class="itemChild">
        </div>
        <div class="itemChild">
        </div>
    </div>
</div>

JS

//on hover event for each post
$('div.item', '#items').live('mouseover mouseout', function(event){
    if (event.type == 'mouseover'){
        //fire mouseover handler
    }
    else{
        //fire mouseout handler
    }
});

Is there a way to stop live from firing when hovering the children of div.item?

By the way the children of div.item cover it completely.

Basically I want this to act like .hover() but bind to things loaded via ajax.

  • 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-16T02:19:57+00:00Added an answer on May 16, 2026 at 2:19 am

    It’s not binding to the children. It’s bubbling up to the parent.

    Also, your syntax isn’t correct. This:

    $("div.item", "div.items")...
    

    is saying “find me all the divs with class item that are descendants of divs with class of items. But you have no such divs (with class items). You have a div with an ID of items.

    Combining all this try:

    $("#items div").live("mouseover mouseout", function(event) {
      if ($(event.source).hasClass("itemChild")) {
        return false;
      } else if (event.type == "mouseover") {
        ...
      } else {
        ...
      }
    });
    

    Or, alternatively:

    $("#items > div.item").live("mouseover mouseout", function(event) {
      if (!($this).is("div.item")) {
        return false;
      }
      ...
    });
    

    Basically, there are many ways to skin this cat but like I said in the first sentence, you have to understand that events bubble up until the handlers stop propagation, either directly (by calling event.stopPropagation() or by returning false from the event handler, which is equivalent to event.stopPropagation(); event.preventDefault();).

    Also, if you’re doing mouseenter and mouseout you might as well just use the hover() event that does both of those:

    $("#items > div.item").live("hover", function(event) {
      // mouseenter
    }, function(event) {
      // mouseout
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can a LINQ enabled app run on a machine that only has the .NET
Can someone guide me on a possible solution? I don't want to use /bin/cp
can someone explain why the compiler accepts only this code template<typename L, size_t offset,
I want use html5's new tag to play a wav file (currently only supported
Can MOSS integrate and get user profiles from multiple Active Directory and/or LDAP stores?
Can a Visual Studio 2008 custom tool be passed additional parameters from the custom
can someone show me the regex for this preg_match. I want to make sure
Does anyone know how can I replace this 2 symbol below from the string
Can somebody point me to a resource that explains how to go about having
Can anyone (maybe an XSL-fan?) help me find any advantages with handling presentation of

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.