Created
July 30, 2018 03:16
-
-
Save rrameshbtech/4ef8ecd4fe2689d8646646736b991351 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<button id="thisButton">Check this</button> | |
<script> | |
const thisButton = document.getElementById('thisButton'); | |
thisButton.addEventListener('click', verifyThis); | |
function verifyThis(event) { | |
//this is bound to the button onwhich the click event is triggered | |
console.log(this === thisButton); // true | |
console.log(this === event.currentTarget); // true | |
} | |
</script> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment