Created
January 25, 2017 23:46
-
-
Save RCTumolac/f302fe6f2c031ff46611008c2a344507 to your computer and use it in GitHub Desktop.
Exported from Popcode. Click to import: https://popcode.org/?gist=f302fe6f2c031ff46611008c2a344507
This file contains hidden or 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>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> |
This file contains hidden or 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 hidden or 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
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