Skip to content

Instantly share code, notes, and snippets.

@ragmha
Forked from anonymous/index.html
Created January 10, 2017 11:58
Show Gist options
  • Select an option

  • Save ragmha/cc8df873abd87d058ff847d89bc0d3f5 to your computer and use it in GitHub Desktop.

Select an option

Save ragmha/cc8df873abd87d058ff847d89bc0d3f5 to your computer and use it in GitHub Desktop.
Cat Clicker :D
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style id="jsbin-css">
h1 {
text-align: center;
}
</style>
</head>
<body>
<h1>Cat clicker! </h1>
<img id="cat"
src="https://lh3.ggpht.com/nlI91wYNCrjjNy5f-S3CmVehIBM4cprx-JFWOztLk7vFlhYuFR6YnxcT446AvxYg4Ab7M1Fy0twaOCWYcUk=s0#w=640&h=426"></img>
<script id="jsbin-javascript">
var elem = document.getElementById('cat');
var count = 0;
elem.addEventListener('click', function(e){
count++;
console.log('I am clicked: '+ count);
console.log('meow');
});
</script>
<script id="jsbin-source-css" type="text/css">h1 {
text-align: center;
}</script>
<script id="jsbin-source-javascript" type="text/javascript">var elem = document.getElementById('cat');
var count = 0;
elem.addEventListener('click', function(e){
count++;
console.log('I am clicked: '+ count);
console.log('meow');
});</script></body>
</html>
h1 {
text-align: center;
}
var elem = document.getElementById('cat');
var count = 0;
elem.addEventListener('click', function(e){
count++;
console.log('I am clicked: '+ count);
console.log('meow');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment