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 trialVictor Albarran
4,662 PointsPerform: Changing Classes
I have an error in the console that says the following in the console:
app.js:72 Uncaught TypeError: Cannot set property 'value' of null at HTMLButtonElement.editTask (app.js:72)
but it did work for Andrew and not for me, I have checked all the the code and I do not see any mistake. here is the code:
// edit and existing task
var editTask = function() {
console.log("Edit task...");
var listItem = this.parentNode;
var editInput = listItem.querySelector("input[type=text]");
var label = listItem.querySelector("label");
var containsClass = listItem.classList.contains("editMode");
//if the class of the parent is .editmode
if(containsClass) {
//Switch from .editmode
//label text become the input's value
label.innerText = editInput.value;
} else {
//switch to .editmode
//input value becomes the label's text
editInput.value = label.innerText; //this is line 72 referred on the console
}
//toggle .editmode on the listitem
listItem.classList.toggle("editMode");
}```
Umesh Ravji
42,386 PointsUmesh Ravji
42,386 PointsCould you please provide which course this is for?