Using the HTML DOM knowledge you have gained so far,
add a third movie to the list of favourite movies.
The movie title, description, and
the poster image URL are already provided
in the code block.
You need to perform the following tasks:
- Create an
li
element and assign it to a variable newMovie
.
- Add the class
movie
to this li
element.
- Create an
img
element and assign it to a variable poster
.
- Use the provided
imageUrl
and title
as image source and alt text.
- Create an
h2
element and assign it to a variable movieTitle
.
- Set the innerText of this element to the value of the
title
variable.
- Create an
p
element and assign it to a variable movieDescription
.
- Set the innerText of this element to the value of the
description
variable.
- Append
poster
, movieTitle
and movieDescription
to newMovie
.
- Select the
ul
element and assign it to a variable movieList
.
- Finally, append the
newMovie
to movieList
.
We are not displaying the answer for this exercise.
We do this because we want you to challenge yourself
and
not give in to the temptation of looking at the solution.
We also don't want to leave you stuck, so if you feel
you have tried enough and are still unable to solve
this exercise, feel free to ask in our community.
Here is the link to join the community.