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 Web Accessibility: Checkboxes!
You have completed Practice Web Accessibility: Checkboxes!
Preview
This video covers one solution to the challenge.
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
Don't worry if you didn't, keep watching
to see one solution and then go ahead and
0:00
give it another try.
0:00
First, I selected all checkbox
inputs present in the HTML using
0:02
querySelectorAll and
assign them to the checkbox's variable.
0:06
Next, I looped through each
checkbox using the forEach method.
0:11
Then I added an event listener for
the focus event to each checkbox.
0:15
When a checkbox gains focus,
the focus event listener is triggered.
0:19
Inside of the focus event listener,
I added the focus class to the checkbox.
0:23
Then, I also added the focus class to
the checkbox's parentElement, the label.
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