Skip to content

Commit cca7849

Browse files
committed
Events in JS
1 parent 51d6df9 commit cca7849

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

Chapter 8/47_script.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
//Events
2+
3+
let a = document.getElementsByClassName("container")[0]
4+
a.onclick = () => {
5+
let b = document.getElementsByClassName("container")[0]
6+
b.innerHTML = "Hello World!"
7+
}

Chapter 8/index.html

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,14 @@
3535
</div>
3636
<script src="45_script.js"></script> -->
3737

38-
Hello world
39-
<script src="46_script.js"></script>
38+
<!-- Hello world
39+
<script src="46_script.js"></script> -->
40+
41+
<div class="container" onmouseenter="console.log('container ke andar mouse gaya')"
42+
onclick="console.log('container me click hua')">
43+
<button onclick="alert('hello'); let a = 6; console.log(a)">Click me</button>
44+
</div>
45+
<script src="47_script.js"></script>
4046

4147
</body>
4248

Chapter 8/style.css

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ html, body {
33
width: 100%;
44
}
55

6-
.yellow {
6+
/* .yellow {
77
background-color: yellow;
88
color: white;
99
}
@@ -15,4 +15,9 @@ html, body {
1515
1616
.text-dark {
1717
color: black;
18+
} */
19+
20+
/* for 47th script */
21+
.container{
22+
background: lightblue;
1823
}

0 commit comments

Comments
 (0)