<!--Creating red div box  -->
<center><div id="myDiv1" style="width: 200px; height: 200px; background-color: red; font-size:35px">Touch it</div></center>
//Get the reference to the div element
const div1 = document.getElementById('myDiv1');

//Add event listener for Div
div1.addEventListener('mouseover', () => {
       div1.style.backgroundColor = 'blue';  // change bg-color red to blue

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.