Skip to content

Instantly share code, notes, and snippets.

@hini-manan
Created January 4, 2017 20:35
Show Gist options
  • Save hini-manan/3d161a648e9d44fbeefb34ee2fe69995 to your computer and use it in GitHub Desktop.
Save hini-manan/3d161a648e9d44fbeefb34ee2fe69995 to your computer and use it in GitHub Desktop.
Exported from Popcode. Click to import: https://popcode.org/?gist=3d161a648e9d44fbeefb34ee2fe69995
<!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 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 ("my name is AWESOME");});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment