Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

javascript event currenttarget

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);

// Click around and make paragraphs disappear
Comment

PREVIOUS NEXT
Code Example
Javascript :: jest Your test suite must contain at least one test. 
Javascript :: mongodb text search 
Javascript :: can we call ajax inside ajax success 
Javascript :: p5js click on button 
Javascript :: javascript return string 
Javascript :: js blur element 
Javascript :: jquery get all classes of a div 
Javascript :: override important css 
Javascript :: execute command js 
Javascript :: capture keystrokes in javascript 
Javascript :: find items from array of ids mongoose 
Javascript :: javascript object destructing 
Javascript :: create new connection in mongoose 
Javascript :: how to change background color using js 
Javascript :: css vw not working on mobile 
Javascript :: run code snippet 
Javascript :: disable other options in select except the selected 
Javascript :: arrow functions in es6 
Javascript :: json data example 
Javascript :: javascript interview questions for freshers 
Javascript :: angular material button align left 
Javascript :: javascript style guide 
Javascript :: ajax form submit without form tag 
Javascript :: react router how to send data 
Javascript :: how to convert an array into single quote strings 
Javascript :: Add an item to the beginning of an Array 
Javascript :: how to use graphql api in react 
Javascript :: Datatable with static json data source 
Javascript :: javascript button click event 
Javascript :: how convert string to int javascript 
ADD CONTENT
Topic
Content
Source link
Name
7+4 =