Skip to content

Instantly share code, notes, and snippets.

@courtney-scripted
Created February 22, 2018 19:41
Show Gist options
  • Save courtney-scripted/f0c2dae6b5bed0074b7063f70fead2de to your computer and use it in GitHub Desktop.
Save courtney-scripted/f0c2dae6b5bed0074b7063f70fead2de to your computer and use it in GitHub Desktop.
Exported from Popcode. Click to import: https://popcode.org/?gist=f0c2dae6b5bed0074b7063f70fead2de
<!DOCTYPE html>
<html>
<head>
<title>jQuery Puns</title>
</head>
<body>
<h1>ScriptEd Pun-A-Thon</h1>
<hr>
<div id="joke-1">
<p>What kind of cheese doesn't belong to you?</p>
<button id="answer1">Answer</button>
</div>
<hr>
<div id="joke-2">
<p>What does the annoying pepper do?</p>
<button id="answer2">Answer</button>
</div>
<hr>
<div id="joke-3">
<p> Why did the bike fall over? </p>
<button id="answer3">Answer</button>
</div>
<hr>
<div id="joke-4">
<img id="joke4img" src="https://i.imgflip.com/8uhl0.jpg">
<button id="answer4">Ugh...</button>
</div>
</body>
</html>
{"enabledLibraries":["jquery"],"hiddenUIComponents":["console","editor.css"]}
$("#joke-1").click( function(){
// Task 1: use .html to change the text in joke-1 to "Nacho Cheese"
});
$("#joke-2").click( function(){
// Task 2: use .append to add a paragraph with "It gets jalapeño face!" in it.
});
// Task 3: Create a click handler that appends a paragraph with "It was two-tired" in it.
// Task 4: Create a click handler for joke-4 that changes the attribute src from the current image to this image --> "http://punpedia.org/wp-content/uploads/2016/09/download-2-3.jpg"
// Bonus: Create a button for each one of these jokes. When the user clicks a button the action should occur
body{
margin-bottom: 100px;
}
div{
font-size: 2em;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment