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 Callback Functions in JavaScript!
You have completed Callback Functions in JavaScript!
Preview
In this video, we'll use the same callback for multiple HTML elements.
This video doesn't have any notes.
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
replaced nameInput with messageTextArea.
0:00
While this is fine,
we have some repetition in our code.
0:03
We have the focus handler twice and
the blur handler twice.
0:07
We can remove the repetition by
moving these event handlers into
0:15
functions with names.
0:19
I'll create two variables,
0:21
const focusHandler and const blurHandler.
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