Comments (9)
Hey, thanks for the help. Since my initial comment, I have found a solution that doesn't bring up any errors and filtering does work.
Wrapping the switch statement within this if statement solves the issue for me:
const mStyle = todo.style;
if (mStyle != undefined && mStyle != null) { //switch statment here! }
This catches if todo.style is undefined so no more TypeError.
from vanilla-todo.
Hi, what worked for me was a slight change to the "app.js" file. Specifically, the section containing "Event Listeners".
Old code: filterOption.addEventListener("click", filterTodo);
New code: filterOption.addEventListener("change", filterTodo);
i.e. Replace "click" with "change". Hopefully, that will solve the issue.
from vanilla-todo.
I have this same problem. I'm following your video and couldn't find what I'm doing wrong.
from vanilla-todo.
Hey, has this been solved? My problem is that it can't filter because of "Uncaught TypeError: Cannot read property 'contains' of undefined" or "Uncaught TypeError: Cannot set property 'display' of undefined". When I console.log(todo), I am able to see the divs but I still don't know when looping in the foreach why its undefined. Help will be greatly appreciated. Thanks
from vanilla-todo.
Hey, has this been solved? My problem is that it can't filter because of "Uncaught TypeError: Cannot read property 'contains' of undefined" or "Uncaught TypeError: Cannot set property 'display' of undefined". When I console.log(todo), I am able to see the divs but I still don't know when looping in the foreach why its undefined. Help will be greatly appreciated. Thanks
Instead of writing e.target.value write e.target.nodeValue. The error will not be there, but still filtering doesn't work.
from vanilla-todo.
Hi, what worked for me was a slight change to the "app.js" file. Specifically, the section containing "Event Listeners".
Old code: filterOption.addEventListener("click", filterTodo); New code: filterOption.addEventListener("change", filterTodo);
i.e. Replace "click" with "change". Hopefully, that will solve the issue.
For me it didnt worked on mobile (it only filtered once i clicked the select menu again), desktop was fine. Since i added "change" as suggested it works perfectly. Thanks :)
from vanilla-todo.
Hey, thanks for the help. Since my initial comment, I have found a solution that doesn't bring up any errors and filtering does work.
Wrapping the switch statement within this if statement solves the issue for me:
const mStyle = todo.style;
if (mStyle != undefined && mStyle != null) { //switch statment here! }
This catches if todo.style is undefined so no more TypeError.
Thank you, this has solved the issue for me with "Uncaught TypeError: todo.classList is undefined"
from vanilla-todo.
Also here is the discussion about this error https://stackoverflow.com/questions/61541582/element-style-and-element-classlist-is-undefined
from vanilla-todo.
Hey, thanks for the help. Since my initial comment, I have found a solution that doesn't bring up any errors and filtering does work.
Wrapping the switch statement within this if statement solves the issue for me:
const mStyle = todo.style;
if (mStyle != undefined && mStyle != null) { //switch statment here! }
This catches if todo.style is undefined so no more TypeError.
Thank you! I was stuck with this part and this really help me to move forwards
from vanilla-todo.
Related Issues (4)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vanilla-todo.