Created
March 9, 2017 01:43
-
-
Save outoftime/a9c3336d96e106394037e522ecc41fa0 to your computer and use it in GitHub Desktop.
Exported from Popcode. Click to import: https://popcode.org/?gist=a9c3336d96e106394037e522ecc41fa0
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> | |
<title>Page Title</title> | |
</head> | |
<body> | |
<h3>How many inches tall are you?</h3> | |
<input><button>Analyze</button> | |
<p id="message"></p> | |
</body> | |
</html> |
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
{"enabledLibraries":["jquery"]} |
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
// 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