Skip to content
Advertisement

Css element does not become active

I’m new to Css and javascript and currently working on a simple project (kinda like a weekly task manager). I created text/html page which contains navbar, 7 dynamic <ul> with “Add task” and “Delete Task buttons”, and each <li> inside of those lists can change it’s state to .active on click (when task is done). However, if i put li manually it works fine, but if I use javascript and button to add new <li> it’s just won’t become active.

JavaScript
JavaScript
JavaScript

Advertisement

Answer

You need to delegate

this code replaces all other code than function addTask() {

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement