Skip to content

Instantly share code, notes, and snippets.

@theabraham
Created November 3, 2011 00:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save theabraham/1335425 to your computer and use it in GitHub Desktop.
Save theabraham/1335425 to your computer and use it in GitHub Desktop.
Guessing Game
- HTML FILE
<html>
<head>
<title>Guessing Game</title>
</head>
<body>
<div><!-- output text will go in here --></div>
<input type="text" />
<button>Guess</button>
</body>
<!-- TODO: load jquery.js and main.js with two '<script>' tags -->
</html>
- JAVASCRIPT FILE
// Tips:
// > use jqapi.com for jQuery documentation (checkout text() and val() methods!)
// > Math.ceil(Math.random() * 25) will give you a random number 1 - 25.
// > get something barebones working, and then add flair (like effects or new mechanics.)
// 1) create 3 variables to access your output '<div>', input '<input>', and button '<button>' tags.
// 2) create any other variables you may need.
// 3) bind a click event to your '<button>' tag.
// 4) fetch the users input and handle it; dish out some helpful output in response (i.e. 'Your guess was too low!'.)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment