Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed Practice DOM Manipulation: Modal!
You have completed Practice DOM Manipulation: Modal!
Preview
This video covers one solution to the challenge
Resources
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
Keep watching to see my solution and
then go ahead and give it another try.
0:00
I started by adding an event
listener to the country's container.
0:01
Then I'm trying to select the countryCard
that was clicked using the closest method.
0:05
If no card is clicked, as might happen
if a user clicks between cards,
0:10
I stop the code from executing
with a return statement.
0:14
If there is a countryCard,
0:18
I'm using the dataset method to access
the value of the data name attribute.
0:20
I'm using the find method to get
the corresponding information from
0:24
the countries array.
0:28
Finally, I call my displayCountryModal
function and pass it the country object.
0:29
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up