Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

Use regular function with DOM event listeners, when using "this" keyword

const link = document.querySelector('#link')
link.addEventListener('click', () => {
  // this === window
})

const link = document.querySelector('#link')
link.addEventListener('click', function() {
  // this === link
})
Comment

PREVIOUS NEXT
Code Example
Javascript :: _.extend Example 
Javascript :: i18next plural not working 
Javascript :: ajax form submit, gather all data onece 
Javascript :: how to iterate through linked list javascript 
Javascript :: Backbone Save Example 
Javascript :: allow only numbers in textbox javascript onkeypress 
Javascript :: can we Plot observale for ejs 
Javascript :: Load RequireJS Script 
Javascript :: asp.net updatepanel autoscroll fix 
Javascript :: check if a specific user is banned discord js 
Javascript :: react native scan network 
Javascript :: Scale to fit 
Javascript :: Naming Your Componts Vue 
Javascript :: delete all document fragments js 
Javascript :: rpushx redis 
Javascript :: mobile version 
Javascript :: prisma.db json 
Javascript :: starting: intent error type 3 react-native 
Javascript :: javascript loop through array backwords 
Javascript :: window handles 
Javascript :: Make a Responsive Portfolio Website: JavaScript and HTML 
Javascript :: sequelzie order by 
Javascript :: buiding react project 
Javascript :: how to render array buffer binary audio js 
Javascript :: i in javascript 
Javascript :: image gallery functions 
Javascript :: javascript assigning index number to row in table 
Javascript :: Changing the value of a dropdown when the value of a number box changes in AngularJS 
Javascript :: AngularJS Pagination not showing all pages 
Javascript :: Display all posts from database 
ADD CONTENT
Topic
Content
Source link
Name
6+9 =