Skip to content

Instantly share code, notes, and snippets.

@sheafk
Last active December 14, 2016 20:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sheafk/85f3f51f80b6852770a9ca77d7be7e72 to your computer and use it in GitHub Desktop.
Save sheafk/85f3f51f80b6852770a9ca77d7be7e72 to your computer and use it in GitHub Desktop.
Exported from Popcode. Click to import: https://popcode.org/?gist=85f3f51f80b6852770a9ca77d7be7e72
<!DOCTYPE html>
<html>
<head>
<title>jQuery Practice 1</title>
</head>
<body>
<h1>The jQuery Site</h1>
<div id="info"></div>
<div id="cool"> jQuery is cool I guess</div>
<img id="pic" src="www.fake.com">
</body>
</html>
{"enabledLibraries":["jquery"]}
//Task 1: Use jQuery to make the text "The jQuery Site" be green.
$("h1").css("color", "green");
//Task 2: Use jQuery to append the text "This site was made almost entirely using jQuery!" to the id info.
$("#info").append("<p>This site was made almost entirely using jQuery!</p>");
//Task 3: Use jQuery to change the text in the div cool to say "jQuery is AWESOME!"
//hint: this needs to be done using the action .html
$("#cool").html("jQuery is AWESOME!");
//Task 4: Use jQuery to change the source attribute in the ID pic to this link --> "https://cdn.meme.am/instances/57092433.jpg"
//hint: you will need to use a selector found on page 6 of the reference table
$("#pic").attr("src", "https://cdn.meme.am/instances/57092433.jpg");
//Bonus: Use jQuery to make it so that when you click on the h1 tag the text changes to your name
$("h1").click(function() {
$("h1").html("Shea");});
// var audio = new Audio('http://www.freesound.org/data/previews/209/209990_2417953-lq.mp3');
// $("#pic").mouseenter(function() {
// audio.play();
// });
// $("#pic").mouseleave(function(){
// audio.pause();
// });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment