The mouseout event is fired when a pointing device (usually a mouse) is moved off the element that has the listener attached or off one of its children. Note that it is also triggered on the parent when you move onto a child element, since you move out of the visible space of the parent. 

Bubbles Yes
Cancelable Yes
Interface MouseEvent
Event handler property onmouseout

Examples

The following example illustrates the difference between mouseout and mouseleave events.

<ul id="test">
  <li>item 1</li>
  <li>item 2</li>
  <li>item 3</li>
</ul>

<script>
  var test = document.getElementById("test");
  
  
  // this handler will be executed only once when the cursor moves off the unordered list
  test.addEventListener("mouseleave", function( event ) {   
    // highlight the mouseleave target
    event.target.style.color = "purple";

    // reset the color after a short delay
    setTimeout(function() {
      event.target.style.color = "";
    }, 500);
  }, false);
  
  
  // this handler will be executed every time the cursor is moved off a different list-item
  test.addEventListener("mouseout", function( event ) {   
    // highlight the mouseout target
    event.target.style.color = "orange";

    // reset the color after a short delay
    setTimeout(function() {
      event.target.style.color = "";
    }, 500);
  }, false);
</script>

Specifications

Specification Status
UI Events
The definition of 'mouseout' in that specification.
Working Draft
Document Object Model (DOM) Level 3 Events Specification
The definition of 'mouseout' in that specification.
Obsolete

Browser compatibility

No compatibility data found. Please contribute data for "api.Element.mouseout" (depth: 1) to the MDN compatibility data repository.

See also

Document Tags and Contributors

Last updated by: irenesmith,