By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,516 Members | 1,133 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,516 IT Pros & Developers. It's quick & easy.

Mouseout parent element

Expert 100+
P: 164
I am using jQuery to create a mouseout event on an element that contains many children.

Expand|Select|Wrap|Line Numbers
  1. <!-- simplified HTML -->
  2. <div id="wrapper">
  3.    <div id="child-1">... some content...</div>
  4.    <div id="child-2">... some content...</div>
  5. </div>
  6.  

Expand|Select|Wrap|Line Numbers
  1. // simplified JavaScript
  2. $("#wrapper").mouseout(function(){
  3.    alert("Hello World!");
  4. });
  5.  
So, as I move the mouse cursor over the wrapper and its children, as I move between the children, child-1 and child-2, the mouseout event of the parent is firing.

Is this standard? I do not recall a mouseout event firing when you mouseover children of a parent. Is there something I am forgetting to do? Someone please freshen my memory.
May 3 '12 #1

✓ answered by Dormilich

yes, this behaviour is standard since mouseover and mouseout capture/bubble. you can use the non-capturing/non-bubbling mouseenter and mouseleave instead.

Share this Question
Share on Google+
1 Reply


Dormilich
Expert Mod 5K+
P: 8,639
yes, this behaviour is standard since mouseover and mouseout capture/bubble. you can use the non-capturing/non-bubbling mouseenter and mouseleave instead.
May 3 '12 #2

Post your reply

Sign in to post your reply or Sign up for a free account.