Skip to content

Instantly share code, notes, and snippets.

@cesine
Created February 15, 2017 19:19
Show Gist options
  • Save cesine/1b85c721e4001d0439aab2f9120c3597 to your computer and use it in GitHub Desktop.
Save cesine/1b85c721e4001d0439aab2f9120c3597 to your computer and use it in GitHub Desktop.
Example variables Exported from Popcode. Click to import: https://popcode.org/?gist=1b85c721e4001d0439aab2f9120c3597
<!DOCTYPE html>
<html>
<head>
<title>Parts of Speech: We Do</title>
</head>
<body>
<h1 id = "header">This is a page about the parts of speech</h1>
<h1 id = "noun"> This is a noun --> </h1>
<h1 id = "adj"> This is an adjective --> </h1>
<h1 id = "verb"> This is an verb --> </h1>
<div id ="sentence"></div>
</body>
</html>
{"enabledLibraries":["jquery"]}
/*
WE DO: Variable & jQuery practice
*/
// Variables
// We need to define a Noun and an Adjective in our JavaScript file. How would we do this?
var noun = "butterfly";
var adj = "yellow";
// Append
// How can we append our noun variable to the second h1 tag on this page?
$("#noun").append(noun);
// Challenge #1
// append our adjective variable to the third h1 tag on this page.
$("#adj").append(adj);
// Challenge #2
// Complete a similar activity for a verb.
var verb = "sits";
$("#verb").append(verb);
// Challenge #3
// Using jQuery, write a sentence using the noun and adjective you created above. Place this sentence in the div with the ID sentence.
$("#sentence").append("The ");
$("#sentence").append(adj);
$("#sentence").append(" ");
$("#sentence").append(noun);
$("#sentence").append(" ");
$("#sentence").append(verb);
$("#sentence").append(".");
#header{
color: red;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment