Skip to content

Instantly share code, notes, and snippets.

@courtney-scripted
Created August 28, 2017 20:43
Show Gist options
  • Save courtney-scripted/37b45994f38932a27c398bbb19b985ee to your computer and use it in GitHub Desktop.
Save courtney-scripted/37b45994f38932a27c398bbb19b985ee to your computer and use it in GitHub Desktop.
Exported from Popcode. Click to import: https://popcode.org/?gist=37b45994f38932a27c398bbb19b985ee
<!DOCTYPE html>
<html>
<head>
<title>09.1 Basic Conditionals Automatic Test Grader</title>
</head>
<body>
<h1> Second Grade End of Year Test </h1>
<div id= "englishDiv">
<h3> English Language Arts </h3>
<p> What is the abbreviation for Monday? </p>
<input id = "english" placeholder = "your answer">
<button id = "englishButton"> Submit </button>
</div>
<h3> Math </h3>
<p> What is 10 + 10 + 10? </p>
<input id= "math" placeholder = "your answer">
<button id = "mathButton"> Submit </button>
<h3> Social Studies </h3>
<p> What is the capital of New York? </p>
<input id = "socialStudies" placeholder = "your answer">
<button id ="ssButton"> Submit </button>
<h3> Science </h3>
<p> Is ice a solid, liquid, or gas? </p>
<input id = "science" placeholder = "your answer">
<button id="scienceButton"> Submit </button>
</body>
</html>
{"enabledLibraries":["jquery"],"hiddenUIComponents":["editor.css"]}
// English Section: Let's do this together!
$("#englishButton").click(function(){
var englishInput = $("#english").val();
//Write an if/else conditional statement to check if the englishInput is correct (the answer should be Mon.). Use the following 2 lines of jQuery to correspond with the right answer or any wrong answer.
$("#englishDiv").append("Correct!");
$("#englishDiv").append("Wrong! Try again.");
});
// Math section
$("#mathButton").click(function(){
var mathInput = $("#math").val();
//Write an if/else conditional statement to check if the mathInput is correct (the answer should be 30). Use the following 2 lines of jQuery to correspond with the right answer or any wrong answer.
$("#mathDiv").append("Correct!");
$("#mathDiv").append("Wrong! Try again.");
});
// Social Studies section
$("#ssButton").click(function(){
var ssInput = $("#socialStudies").val();
//Write an if/else conditional statement to check if the ssInput is correct (the answer should be Albany).
});
// Science section
//Challenge 1: Create additional questions.
//Challenge 2: Create a function that automatically gives a grade for the whole assignment.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment