Covalence
- This lab consists of two parts
- In this second iteration you will be transforming part 1 of the lab
- You should copy your files from part 1 and paste them along with this README file into a new folder linked to a new github repository
- Put a
button
in the HTML that saysSing!
- Stepping Stone: When you click the button, all the
console.log
statements from yesterday should happen. They SHOULD NOT happen before the button is clicked.
- Stepping Stone: When you click the button, all the
- When you have the button setup and working correctly as described, then:
- Delete the
div
with classfriend
and the headings and paragraphs it contains from your html file - Go to your code where you are "singing the song" and accomplish the following using DOM:
- For every one of your friends, create a
div
with classfriend
- Put an
h3
containing your friend's name in the div - Then, instead of using
console.log
to put the song lyrics in the console, create a paragraph for each song lyric line and put that paragraph in thefriend
div.
- For every one of your friends, create a
- Delete the
- To Recap:
- When you have made these modifications, the page should start out just showing a button labeled "Sing!"
- Nothing will be logged to the console
- Clicking the button will cause 5
div
elements with class namefriend
to be added to the page, one for each of your friends - Each div contains a friend's name as an h3 and 99 paragraphs, each one representing a lyric line that you previously were logging to the console in part 1 of this lab.
- You will be using DOM functions to complete this portion of the lab
- Remember that elements can be added to other elements
- document.body.appendChild(someElement);
- someOtherElement.appendChild(anotherElement);