#Need help with some functionalities

8 messages · Page 1 of 1 (latest)

tawny gale
#

Im working on this todo app, when i checkbox the items it works dynamicly so it would appear in completed task if its checked. But the problem im facing is when the user presses the chekbox from See active tasks, it doesnt show i completed task from pressing teh checkbox in active tasks

its not completed yet but some functionalites are working, check it out if what im saying doesnt make sense
https://jsbin.com/yicagipeke/edit?js,console,output here is the code

also im wondering is there a way to acheive these functionality without having to write this much coe

sullen spear
#

I haven't checked all your code, but it would be much easier if you splitted your code into smaller logical chunks which can be reused.
Like
createTaskObject()
renderTask()
checkTask()
deleteTask()
filterTasks()...

And then think through which action needs to call which function.

For listeners I'd use eventDelegation on the main holding div and give all interactive elements a className.

Then if a button with class is clicked... call the clickHandlerFunction for that action (updating corresponding UI and dataObject)

tawny gale
#

i see what you u mean, i have quite a few reused code

tawny gale
sullen spear
#

I'll take a look. Don't quite understand your description of the unexpected behaviour 😅

#

I think it must be this

checkBox.classList.toggle('completed', checkList.completed)
tawny gale
sullen spear
#

it works for first element, but not for a second one, so there might be another issue that you do not distinguish between the checkBoxes.
But I don't have the time to search for the bug, now.... sry