Skip to content

Instantly share code, notes, and snippets.

@outoftime
Created March 9, 2017 01:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save outoftime/a9c3336d96e106394037e522ecc41fa0 to your computer and use it in GitHub Desktop.
Save outoftime/a9c3336d96e106394037e522ecc41fa0 to your computer and use it in GitHub Desktop.
Exported from Popcode. Click to import: https://popcode.org/?gist=a9c3336d96e106394037e522ecc41fa0
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h3>How many inches tall are you?</h3>
<input><button>Analyze</button>
<p id="message"></p>
</body>
</html>
{"enabledLibraries":["jquery"]}
// Modify the below code so that it checks to see if the user entered a number greater or less than 12
//
// If the number is greater than 12, write "More than a foot" to the page
// If the number is less than 12, write "Less than a foot" to the page
// Otherwise, write "Exactly one foot" to the page
$("button").click(function() {
var userNumber = parseInt($("input").val());
if (userNumber === 0) {
$("#message").html("That’s zero feet.");
} else {
$("#message").html("That’s some feet.");
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment