Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

javascript current target

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 <p> element
  ps[i].addEventListener('click', hide, false);
}
// console: print <body>
document.body.addEventListener('click', hide, false);
Comment

PREVIOUS NEXT
Code Example
Javascript :: react testing for links 
Javascript :: nodemailer send email 
Javascript :: alert, react native alert 
Javascript :: skip arguments in js 
Javascript :: jquery use variable in string "without" concatenate 
Javascript :: react router base url 
Javascript :: unidirectional data flow react 
Javascript :: how to add d3.js in angular 
Javascript :: get minutes and seconds of long seconds 
Javascript :: useref() in react 
Javascript :: js compare elements of two arrays 
Javascript :: Vue minify images 
Javascript :: setting usestate to prop 
Javascript :: Conditionallu inline styling in react 
Javascript :: regex e-mail 
Javascript :: jquery select dropdown 
Javascript :: MAC addresses in JavaScript 
Javascript :: javascript array filter 
Javascript :: how to align text inside react component 
Javascript :: par ou impar js 
Javascript :: javascript sleep 1 second” is a pretty common code problem that people search ;-) 
Javascript :: Error [DISALLOWED_INTENTS]: Privileged intent provided is not enabled or whitelisted. 
Javascript :: js addeventlistener foreach 
Javascript :: react useid hook 
Javascript :: json server paging 
Javascript :: capitalize first carater js 
Javascript :: how to get last child element in javascript 
Javascript :: innertext javascript 
Javascript :: how to get input name in javascript 
Javascript :: watch file in changes in webpack 
ADD CONTENT
Topic
Content
Source link
Name
6+5 =