1function hide(e){
2 e.currentTarget.style.visibility = 'hidden';
3 console.log(e.currentTarget);
4 // When this function is used as an event handler: this === e.currentTarget
5}
6
7var ps = document.getElementsByTagName('p');
8
9for(var i = 0; i < ps.length; i++){
10 // console: print the clicked <p> element
11 ps[i].addEventListener('click', hide, false);
12}
13// console: print <body>
14document.body.addEventListener('click', hide, false);