Skip to content

Instantly share code, notes, and snippets.

@courtney-scripted
Created March 8, 2017 21:56
Show Gist options
  • Save courtney-scripted/495434e29770776deee22a3aaf203520 to your computer and use it in GitHub Desktop.
Save courtney-scripted/495434e29770776deee22a3aaf203520 to your computer and use it in GitHub Desktop.
Exported from Popcode. Click to import: https://popcode.org/?gist=495434e29770776deee22a3aaf203520
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h1> Guess my number! </h1>
<input id="myguess">
<button id="answer">Guess</button>
</body>
</html>
{"enabledLibraries":["jquery"]}
//Step 1: Fill in the id needed for the click function. Ask yourself what you are clicking on, and then look at the id given.
$(/*place id here*/).click (function() {
//Step 2: Create a variable that takes value of the input. HINT: You need to create a variable name and fill in the needed id.
var = $().val();
//Step 3: Write an if statement that evaluates IF the input is LESS THAN your chosen secret number
if () {
//Step 4: Display that the guess was too low
}
//Step 3: Write an else if statement that evaluates if the input is GREATER THAN your chosen secret number
else if (){
//Step 4: Display that the guess was too high
}
//Step 5: Write an else statement that evaluates if the input is EQUAL to your chosen secret number
else {
//Step 6: Display that the guess correct
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment