Skip to content

Instantly share code, notes, and snippets.

@courtney-scripted
Created February 22, 2018 21:22
Show Gist options
  • Save courtney-scripted/dad9a7d987b0b3afaeaa69f20f23d954 to your computer and use it in GitHub Desktop.
Save courtney-scripted/dad9a7d987b0b3afaeaa69f20f23d954 to your computer and use it in GitHub Desktop.
Exported from Popcode. Click to import: https://popcode.org/?gist=dad9a7d987b0b3afaeaa69f20f23d954
<!DOCTYPE html>
<html>
<head>
<title>jQuery Jokes</title>
</head>
<body>
<h1>JQuery Joke Machine</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>
<p id="jokeTwo">Gets jalapeño face!</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">
</div>
</body>
</html>
{"enabledLibraries":["jquery"],"hiddenUIComponents":["console"]}
$("#joke-1").click(function(){
$("#joke-1").text("Nacho Cheese");
});
$("#joke-2").click(function(){
$("#jokeTwo").css("color", "red");
});
$("#joke-3").click(function(){
$("#joke-3").append("It was two tired");
});
$("#joke4img").hover(function(){
$("#joke4img").attr("src", "http://punpedia.org/wp-content/uploads/2016/09/download-2-3.jpg");
});
body{
margin-bottom: 100px;
}
div{
font-size: 2em;
}
#jokeTwo{
color:white;
}
img{
width:300px;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment