📌  相关文章
📜  javascript 当前目标 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:36.055000             🧑  作者: Mango

代码示例1
function hide(e){
  e.currentTarget.style.visibility = 'hidden';
  console.log(e.currentTarget);
  // When this function is used as an event handler: this === e.currentTarget
}

var ps = document.getElementsByTagName('p');

for(var i = 0; i < ps.length; i++){
  // console: print the clicked 

element ps[i].addEventListener('click', hide, false); } // console: print document.body.addEventListener('click', hide, false);