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 jQuery Basics!
You have completed jQuery Basics!
Preview
Learn about event delegation and how it can be used to add event listeners to dynamically added DOM elements.
Further Reading
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
When the code base of a website
gets larger and more and
0:00
more people work on it, you can't always
guarantee the order in which elements get
0:00
added to the page and when the event
listeners are added to the page.
0:04
Go ahead and open up the workspace
with this video now and
0:07
I'll show you what I mean.
0:10
I'll change this method back to click.
0:11
And I'll move this event listener code
above where we append the button to
0:19
the page.
0:23
Save and preview, click on the button,
and it doesn't work, nothing happens.
0:25
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