Skip to content

Instantly share code, notes, and snippets.

@LtAstros
Created February 15, 2017 01:15
Show Gist options
  • Save LtAstros/871b8b4d3869fcbbb9e4bbc05216a63a to your computer and use it in GitHub Desktop.
Save LtAstros/871b8b4d3869fcbbb9e4bbc05216a63a to your computer and use it in GitHub Desktop.
Exported from Popcode. Click to import: https://popcode.org/?gist=871b8b4d3869fcbbb9e4bbc05216a63a
<!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("This site was made almost entirely using jQuery!");
//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("Costin Smilovici");
});
$("h1").mouseleave(function() {
$("h1").html("The jQuery Site");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment