Skip to content

Instantly share code, notes, and snippets.

@stormsweeper
Created March 28, 2018 19:01
Show Gist options
  • Save stormsweeper/312818c41e39fc8577471ec56a1f4a35 to your computer and use it in GitHub Desktop.
Save stormsweeper/312818c41e39fc8577471ec56a1f4a35 to your computer and use it in GitHub Desktop.
Exported from Popcode. Click to import: https://popcode.org/?gist=312818c41e39fc8577471ec56a1f4a35
<!DOCTYPE html>
<html>
<head>
<title>jQuery Review</title>
</head>
<body>
<div>
Review 1:
<button id="button1">Pop up an alert</button>
</div>
<div>
Review 2:
<button id="button2">Put some text in a div</button>
<div id="review2_div"></div>
</div>
<div>
Review 3:
<button id="button3">Put some HTML in a div</button>
<div id="review3_div"></div>
</div>
<div>
Review 4:
<input id="review4_input">
<button id="button4">Pop up an alert of the input</button>
</div>
<div>
Review 5:
<input id="review5_input">
<button id="button5">Pop up an alert of the input with other text</button>
</div>
<div>
Review 6:
<input id="review6_input">
<button id="button6">Put the input in a div</button>
<div id="review6_div"></div>
</div>
<div>
Review 7:
<input id="review7_input">
<button id="button7">Put the input in a div with other text</button>
<div id="review7_div"></div>
</div>
<div>
Review 8:
<button id="button8">Set some CSS of a DIV</button>
<div id="review8_div">This is a DIV</div>
</div>
<div>
Review 9:
<button id="button9">Swap an image</button>
<img id="review9_img" src="http://www.emoji.co.uk/files/apple-emojis/smileys-people-ios/26-nerd-face.png">
</div>
<div>
Review 10:
<input id="review10_input" type="number">
<button id="button10">Guess the number</button>
<div id="review10_div"></div>
</div>
<div>
Review 11:
<input id="review11_input" type="number">
<button id="button11">High or low?</button>
<div id="review11_div"></div>
</div>
<div>
Review 12:
<input id="review12_input" type="number">
<button id="button12">Either number</button>
<div id="review12_div"></div>
</div>
<div>
Review 13:
<input id="review13_input_school" placeholder="school?">
<input id="review13_input_class" placeholder="class?">
<button id="button13">Where are we?</button>
<div id="review13_div"></div>
</div>
</body>
</html>
{"enabledLibraries":["jquery"],"hiddenUIComponents":["console","editor.css"]}
// Review 1 - pop up an alert
$("#button1").click(function(){
// show an alert that says "Hello"
});
// Review 2 - put some text in a div
$("#button2").click(function(){
// Use jQuery to put "Hello" in the div: #review2_div
});
// Review 3 - put some HTML in a div
$("#button3").click(function(){
// Use jQuery to put a link to the QVT website (http://www.queensvoc.org/) in the div: #review3_div
});
// Review 4 - pop up an alert of the input
$("#button4").click(function(){
// show an alert with the value of the input: #review4_input
});
// Review 5 - pop up an alert of the input with other text
$("#button5").click(function(){
// show an alert that says "Hello, NAME", where NAME is the value of the input: #review5_input
});
// Review 6 - put the input in a div
$("#button6").click(function(){
// put the value of the input: #review6_input into div: #review6_div
});
// Review 7 - put the input in a div with other text
$("#button7").click(function(){
// put text that says "Hello, NAME" into div: #review7_div where NAME is the value of the input: #review7_input
});
// Review 8 - set some CSS
$("#button8").click(function(){
// Use jQuery to change the CSS for div: #review8_div
// - make the background color red
// - make the text color blue
// - make the border dashed
});
// Review 9 - swap an image
$("#button9").click(function(){
// Use jQuery to swap the image in: #review9_img
// set the source to: http://www.emoji.co.uk/files/apple-emojis/smileys-people-ios/27-smiling-face-with-sunglasses.png
});
// Review 10 - if/else
$("#button10").click(function(){
// Read the value of input: #review10_input and put a message in div: #review10_div
// if it is 5, put "Correct!"
// if not, put "Wrong!"
});
// Review 11 - if/else if/else
$("#button11").click(function(){
// Read the value of input: #review11_input and put a message in div: #review11_div
// if it is 5, put "Correct!"
// if less than 5, put "too low"
// if more than 5, put "too high"
});
// Review 12 - compound conditionals OR
$("#button12").click(function(){
// Read the value of input: #review12_input and put a message in div: #review12_div
// if it is 5 or 13, put "Correct!"
// if not, put "Wrong!"
});
// Review 13 - compound conditionals AND
$("#button13").click(function(){
// Read the value of inputs: #review13_input_school and #review13_input_class and put a message in div: #review12_div
// If they typed "QueensVoc" and "ScriptEd", put "Correct!"
// if they typed "QueensVoc" but not "ScriptEd", put "Wrong class"
// if they typed "ScriptEd" but not "QueensVoc", put "Wrong school"
});
div{
background-color: #eee;
margin: 30px;
padding: 10px;
border: 1px solid #bbb;
}
#review9_img{
width: 100px;
height: 100px;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment