Last Updated : 20 Jun, 2023
The DOM onmouseenter event in HTML occurs when the mouse pointer is moved onto an element. This event is the opposite of onmouseleave event.
This event is similar to the onmouseover event.
Supported Tags: It supports All HTML elements, EXCEPT:
Syntax:
<element onmouseenter="myScript">
object.onmouseenter = function(){myScript};
object.addEventListener("mouseenter", myScript);
Example: Using the addEventListener() method
HTML
<!DOCTYPE html>
<html>
<head>
<title>
HTML DOM onmouseenter Event
</title>
</head>
<body>
<h1 id="demo">GeeksforGeeks</h1>
<script>
document.getElementById(
"demo").addEventListener(
"mouseenter", enter);
function enter() {
document.getElementById(
"demo").style.color = "green";
}
</script>
</body>
</html>
Output:
Supported Browsers: The browsers supported by HTML DOM onmouseenter Event are listed below:
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4