1+ < ! DOCTYPE html >
2+ < html lang = "en" >
3+ < head >
4+ < meta charset = "UTF-8" >
5+ < meta name = "viewport" content = "width=device-width, initial-scale=1.0" >
6+ < title > LEARNING EVENTS</ title >
7+ < style >
8+ .bg-black{
9+ background - color : black ;
10+ color : white ;
11+ }
12+ </ style >
13+ </ head >
14+ < body class = "bg-black" >
15+ < h2 > Amazing image</ h2 >
16+ < div >
17+ < ul id = "images" >
18+ < li > < img width = "200px" id = "photoshop" src = "https://images.pexels.com/photos/3561339/pexels-photo-3561339.jpeg?auto=compress& cs = tinysrgb & w = 1600 & lazy = load " alt = "photoshop" > </ li >
19+ < li > < img width = "200px" id = "japan" src = "https://images.pexels.com/photos/3532553/pexels-photo-3532553.jpeg?auto=compress& cs = tinysrgb & w = 1600 & lazy = load " alt = "" > </ li >
20+ < li > < img width = "200px" id = "river" src = "https://images.pexels.com/photos/3532551/pexels-photo-3532551.jpeg?auto=compress& cs = tinysrgb & w = 1600 & lazy = load " alt = "" > </ li >
21+ < li > < img width = "200px" id = "owl" src = "https://images.pexels.com/photos/3532552/pexels-photo-3532552.jpeg?auto=compress& cs = tinysrgb & w = 1600 & lazy = load " alt = "" > </ li >
22+ < li > < img width = "200px" id = "prayer" src = "https://images.pexels.com/photos/2522671/pexels-photo-2522671.jpeg?auto=compress& cs = tinysrgb & w = 1600 & lazy = load " alt = "" > </ li >
23+ < li > < a style = "color: aliceblue;" href = "https://google.com" id = "google" > Google</ a > </ li >
24+ </ ul >
25+ </ div >
26+ </ body >
27+ < script >
28+ // document.getElementById('owl').onclick = () => {
29+ // alert("Hello World")
30+ // }
31+
32+ //false then its bubbling
33+ //true then its capturing
34+ // document.getElementById('images').addEventListener('click',(e)=>{
35+ //console.log("clicked InSide the ul")
36+ //},false)
37+ //document.getElementById('owl').addEventListener('click',(e)=>{
38+ //alert("Hello World");
39+ // e.preventDefault();
40+ // console.log(e.target);
41+ //console.log("owl ul")
42+ // e.stopPropagation();
43+
44+ //},false)
45+
46+ //document.getElementById('google').addEventListener('click',(e)=>{
47+ //alert("Hello World");
48+ // e.preventDefault();
49+ // console.log(e.target);
50+ // console.log("google cliked")
51+ // e.preventDefault();
52+ // e.stopPropagation();
53+
54+ //},false)
55+
56+
57+ document . querySelector ( '#images' ) . addEventListener ( 'click' , ( e ) => {
58+ // console.log(e.target)
59+ if ( e . target . tagName === 'IMG' ) {
60+ console . log ( e . target . id ) ;
61+ e . target . parentNode . remove ( ) ;
62+ }
63+
64+ } )
65+
66+
67+
68+ < / s c r i p t >
69+ </html >
0 commit comments