<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Title</title>
<script src="https://code.jquery.com/jquery-3.7.0.min.js"></script>
<style>
.box {
width: 100px;
height: 100px;
margin: 10px;
}
#box1 {
background-color: blue;
}
#box2 {
background-color: green;
}
</style>
</head>
<body>
<div class="box" id="box1"></div>
<div class="box" id="box2"></div>
</body>
<script>
$("#box1").on("mouseover", () => {
$("#box1").css("backgroundColor", 'red')
});
$("#box2").hover(()=>{
//마우스 오버일떄
$("#box2").css("backgroundColor","yellow");
},()=>{
//마우스 아웃일떄
$("#box2").css("backgroundColor","blue");
})
</script>
</html>
댓글 영역