+ 2

Can anyone explain me why k.style.display="none" don't works in script tag in last line?

https://code.sololearn.com/W12R7746wGM3/?ref=app

7th Jun 2020, 9:45 AM
Abhay
Abhay - avatar
6 odpowiedzi
+ 1
in the first event listener you use document.documentElement. this will be active whenever the page is clicked as it will display block. this is in conflict with the second event listener.
7th Jun 2020, 10:25 AM
Logomonic Learning
Logomonic Learning - avatar
+ 2
Logomonic Learning thks I was wondering same
7th Jun 2020, 10:25 AM
Abhay
Abhay - avatar
+ 2
Yup
7th Jun 2020, 10:44 AM
Abhay
Abhay - avatar
+ 1
Alternative: Could use event.cancelBubble - "a setting of true before returning from an event handler prevents propagation of the event." MDN. https://developer.mozilla.org/en-US/docs/Web/API/Event/cancelBubble
7th Jun 2020, 5:32 PM
ODLNT
ODLNT - avatar
+ 1
ODLNT thank you
7th Jun 2020, 8:11 PM
Abhay
Abhay - avatar
0
you will need to remove the first event listener
7th Jun 2020, 10:29 AM
Logomonic Learning
Logomonic Learning - avatar