Skip to content

Instantly share code, notes, and snippets.

@jcupitt
Last active October 28, 2019 15:43
Show Gist options
  • Save jcupitt/5ff60adc3a9bf61a22ee184d9636bdee to your computer and use it in GitHub Desktop.
Save jcupitt/5ff60adc3a9bf61a22ee184d9636bdee to your computer and use it in GitHub Desktop.
attach a handler
<!DOCTYPE html>
<html>
<head>
<title>HELLO GOOBLERAMPLING</title>
</head>
<body>
<a href="viewerPage.html" target="_blank" id="myPicture">
<img src="thePic.png">
</a>
<script>
document
.getElementById("myPicture")
.addEventListener("click", function() {
var thisPic = this.getElementsByTagName("img")[0].src;
console.log("thisPic = " + thisPic);
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment