Head Rush Ajax (Head First)

4a.9. After addToTop5() runs...

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 for the first CD clicked, the DOM tree should look like this. body div divWhen the <img> element is moved, it's no longer underneath the "cds" <div>. That means that it "disappears" from the top of the page. div form img img img img h2 div imgThe <img> element is now under the "top5" <div>, and will show up on the bottom of the page.

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>?

Категории