Created
March 12, 2021 05:53
-
-
Save bogoreh/739dbf8c88b56e46d3d2bff47c11c204 to your computer and use it in GitHub Desktop.
This file contains 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
<!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