Skip to content

Instantly share code, notes, and snippets.

@alexpelan
Created March 20, 2017 03:37
Show Gist options
  • Select an option

  • Save alexpelan/d719e220f65b1b911df87ccf2d3beea2 to your computer and use it in GitHub Desktop.

Select an option

Save alexpelan/d719e220f65b1b911df87ccf2d3beea2 to your computer and use it in GitHub Desktop.
Exported from Popcode. Click to import: https://popcode.org/?gist=d719e220f65b1b911df87ccf2d3beea2
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<p>If the number is greater than 0 and less than 100, append "That's a small number."</p>
<p>If the number is greater than or equal to 100 and less than 1000, append "That's a medium number"</p>
<p>If the number is greater than 1000, append "That's a large number."</p>
<input>
<button>Click!</button>
</body>
</html>
{"enabledLibraries":["jquery"]}
$("button").click(function() {
var number = parseInt($("input").val());
// try "-1"
if (number < 100) {
$("body").append("That's a small number");
}
// try "99"
if (number < 1000) {
$("body").append("That's a medium number");
}
if (number > 1000) {
$("body").append("That's a large number");
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment