dom basic practice
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>replit</title>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h1>This is heading</h1>
<div class="box"></div>
<script src="index.js"></script>
</body>
</html>
body{
text-align: center;
}
div{
height: 100px;
width: 1000px;
border: 1px solid black;
margin: auto;
}
let h1 = document.querySelector("h1")
h1.addEventListener("click", function(){
console.log("h1 was clicked");
})
let box = document.querySelector(".box")
box.addEventListener("mouseenter", function(){
console.log("mouse inside the box");
})
Comments
Post a Comment