Source Code:
(back to article)
Submit
Result:
Report an issue
<button id="hoverButton">Hover Over Me!</button> <script> const button = document.getElementById('hoverButton'); button.addEventListener('mouseover', function() { this.style.backgroundColor = 'green'; }); button.addEventListener('mouseout', function() { this.style.backgroundColor = ''; }); </script>