Skip to content

Instantly share code, notes, and snippets.

@RCTumolac
Created January 25, 2017 23:46
Show Gist options
  • Save RCTumolac/f302fe6f2c031ff46611008c2a344507 to your computer and use it in GitHub Desktop.
Save RCTumolac/f302fe6f2c031ff46611008c2a344507 to your computer and use it in GitHub Desktop.
Exported from Popcode. Click to import: https://popcode.org/?gist=f302fe6f2c031ff46611008c2a344507
<!DOCTYPE html>
<html>
<head>
<title>Input Test</title>
</head>
<body>
<form>
<h1>Number between 1 and 100</h1>
Enter Value:
<input id = "input" type = "text">
<button id = "button"> Enter </button>
</form>
<h2></h2>
</body>
</html>
{"enabledLibraries":["jquery"]}
var number = 7;
$("#button").click(function(){
var input = $("#input").val();
if(input > number){
$("h2").html("Too high");
}
else if(input < number){
$("h2").html("Too low");
}
else{
$("h2").html(input + " is the number!");
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment