Skip to content

Instantly share code, notes, and snippets.

@bogoreh
Created March 12, 2021 05:53
Show Gist options
  • Save bogoreh/739dbf8c88b56e46d3d2bff47c11c204 to your computer and use it in GitHub Desktop.
Save bogoreh/739dbf8c88b56e46d3d2bff47c11c204 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Challenge: Croc Clicker</title>
</head>
<body>
<button id="results"></button>
<h1>Challenge: Croc Clicker</h1>
<img id="crocs" src="https://www.kasandbox.org/programming-images/animals/crocodiles.png" width="300" alt="Crocodiles chilling">
<div id="results"></div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script>
var numClicks = 0;
$("#results").text("You clicked " + numClicks + " times");
$("#crocs").on("click", function(){
numClicks +=1;
$("#results").text("You clicked " + numClicks + " times");
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment