Giter Site home page Giter Site logo

Comments (9)

KafkaIsK avatar KafkaIsK commented on August 10, 2024 2

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.

bbolshinsky avatar bbolshinsky commented on August 10, 2024 1

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.

JJacoBB13 avatar JJacoBB13 commented on August 10, 2024

I have this same problem. I'm following your video and couldn't find what I'm doing wrong.

from vanilla-todo.

KafkaIsK avatar KafkaIsK commented on August 10, 2024

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.

allaboutchris2020 avatar allaboutchris2020 commented on August 10, 2024

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.

qwerty084 avatar qwerty084 commented on August 10, 2024

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.

miroslavsavel avatar miroslavsavel commented on August 10, 2024

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.

miroslavsavel avatar miroslavsavel commented on August 10, 2024

Also here is the discussion about this error https://stackoverflow.com/questions/61541582/element-style-and-element-classlist-is-undefined

from vanilla-todo.

Pamguicha avatar Pamguicha commented on August 10, 2024

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 photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.