-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path123.js
More file actions
32 lines (23 loc) · 859 Bytes
/
Copy path123.js
File metadata and controls
32 lines (23 loc) · 859 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// event object
// const firstButton = document.querySelector("#one");
// firstButton.addEventListener("click", function(event){
// console.log(event);
// })
// jab bhi mai kisi bhi element pe event listener add hoga
// js Engine --- line by line execute karta hai
// browser ---- js Engine + extra features
// browser ----- js Engine + WebApi
// jab browser ko pata chala ki user ne event perform kia
// jo hum listen kar rahe hai
// browser ----- 2
// 1.) callback function hai vo js Engine ko degi ......
// 2.) callback function ke sath browser jo event hua hai uski information bhi dega
// ye info hamein ek object ke form mai milegi
const allButtons = document.querySelectorAll(".my-buttons button");
for (let button of allButtons)
{
button.addEventListener("click", (e) =>
{
console.log(e.currentTarget);
})
}