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 trialRachel Bailey
8,862 PointsMy console is telling me: "Uncaught TypeError: Cannot set property 'onchange' of null"
If someone could help me out, I would greatly appreciate it!
4 Answers
Kristopher Van Sant
Courses Plus Student 18,830 PointsHey Rachel. Take a look at line 55 in app.js. You have a space that shouldn't be there, "input [type=checkbox]". If you remove the space after input it should fix the error message you're getting. Are you also getting an error that says "Cannot read property 'children' of undefined"?
Steven Parker
231,269 PointsOn line 55 of app.js, you have:
var checkBox = taskListItem.querySelector("input [type=checkbox]");
The space between input and [type=checkbox] makes this a descendant selector, so it's looking for an item of type "checkbox" that is a descendant of an input element. There are none, so it sets checkBox to null.
Remove the space so it will find an input of type "checkbox".
Steven Parker
231,269 PointsHeh. I took a break while composing that and someone posted something similar.
So, since it was brought up, on line 4 you have:
var completedTaskHolder;
But you probably want:
var completedTaskHolder = document.getElementById('completed-tasks');
Rachel Bailey
8,862 PointsThose changes definitely helped!!!
But my hot mess of code still won't run. Now it's saying: Uncaught TypeError: Cannot read property 'querySelector' of undefinedbindTaskEvents
Any ideas?
Kristopher Van Sant
Courses Plus Student 18,830 PointsYay! Glad everything's helped so far. Last thing, on line 79 you have incompleteTaskHolder instead of completedTaskHolder :)
Rachel Bailey
8,862 PointsYou are totally right!!!
Now my console is saying that completedTaskHolder is undefined? This code hates everything I do!
Kristopher Van Sant
Courses Plus Student 18,830 PointsHaha noooo! It doesn't hate what you're doing I promise. It's always the little things. Hmmm, I'm not sure! Double check each of the things we mentioned to change. And if you haven't removed or added anything else it should be working now. :/
So line 6 should like this ..,
var completedTaskHolder = document.getElementById("completed-tasks");
line 55
var checkBox = taskListItem.querySelector("input[type=checkbox]");
and line 79
for(var i = 0; i < completedTaskHolder.children.length; i++) {
If you'd like, post an updated snapshot of what you've changed so far and I'll take a look!
Rachel Bailey
8,862 PointsIT'S WORKING!!!!!!
You can't see the dance I'm doing, but it's joyous.
I forgot the "d" in complete(d)TaskHolder on line 79.
THANK YOU!!!!!!!
Kristopher Van Sant
Courses Plus Student 18,830 PointsAhh! Hooray! So happy you figured it out! :) Haha I believe it, the "I've finally gotten the code to work!" dance is one I'm very familiar with. And again it's always those little things. Going through this just makes you that much more aware of paying attention to small details like that, so it's a great learning experience. Keep up the awesome work Rachel!