you’re on your way 4
257
developing dom apps
div
div
img
img
img
img
img
body
div
The <img> element is now under
the “top5” <div>, and will show
up on the bottom of the page.
After addToTop5() runs for
the rst CD clicked, the
DOM tree should look like this.
When the <img> element is moved, it’s no longer
underneath the “cds” <div>. That means that it
“disappears” from the top of the page.
form
div
h2
When someone clicks on a CD cover image, addToTop5() will run. We
want that JavaScript function to take the <img> element that was clicked
on, and move it from the “cds” <div> to the “top5” <div>. Here’s what
the end result should look like:
After addToTop5() runs...
brain
power
What do you think will happen to the web page when the <img>
element is moved from the “cds” <div> to the “top5” <div>?