Home

mouseenter

Mouseenter is a mouse event in the web browser DOM that fires when the pointer enters the boundary of a specified element. It is part of the standard set of mouse events used to respond to pointer movement and is supported by modern browsers.

Unlike the related mouseover event, mouseenter does not bubble up through the DOM and generally fires only

Usage typically involves listening for the event with addEventListener or an onmouseenter attribute, for example: element.addEventListener('mouseenter',

when
the
pointer
enters
the
element
to
which
the
handler
is
attached.
It
does
not
repeatedly
fire
when
the
pointer
moves
among
the
element’s
descendants.
This
makes
mouseenter
convenient
for
triggering
actions
once
when
a
user
first
hovers
over
a
region,
without
reacting
to
every
movement
over
inner
elements.
If
you
need
to
detect
movement
across
nested
elements
or
want
bubbling
behavior,
mouseover
and
mouseout
or
event
delegation
can
be
used
as
alternatives.
CSS
hover
styling
can
also
achieve
similar
visual
effects
without
JavaScript.
handler).
The
event
object
is
a
MouseEvent
and
provides
standard
properties
such
as
clientX,
clientY,
screenX,
screenY,
and
relatedTarget
(the
element
the
pointer
came
from).
Cross-browser
support
is
strong
in
modern
environments;
on
touch
devices
or
pointerless
contexts,
mouseenter
may
not
fire.
In
accessibility-conscious
design,
hover-based
interactions
should
not
be
relied
on
exclusively,
and
keyboard
or
focus-based
mechanisms
should
be
provided.