Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialMatthew Cahn
6,301 PointsUncaught TypeError: Cannot read property 'querySelector' of undefined
I'm getting this error for this piece of code:
var checkBox = taskListItem.querySelector("input[type=checkbox]");
is there something wrong with it?
2 Answers
Michael Mayer
6,161 PointsYou need checkbox to be in parenthesis. Try this:
var checkBox = taskListItem.querySelector("input[type='checkbox']");
Matthew Cahn
6,301 PointsI don't know what I did but it works now. Thanks for the help.
Matthew Cahn
6,301 PointsMatthew Cahn
6,301 PointsTried it. 'fraid it didn't work. still getting the same error.
Michael Mayer
6,161 PointsMichael Mayer
6,161 PointsSorry, by parenthesis I meant quotes. Anyway, the code above is working on my machine. Is there possibly an error in your HTML? Generally you should post all the code necessary to reproduce your issue. :D