How do I use a checkbox and JS to decorate texts?

I’m trying to build a To-Do App with Javascript, right now I’m trying to figure out, how to strike through a todo item with a checkbox and undo that. I’ve already tried to achieve the same with a button and I got the text to be striken through when I clicked the button, but I couldn’t figure out how to undo it.

Here is a codepen link (I hope it works?).
Thanks for any kind of help!

You can try to add the onclick on the lists and create a function that will change the style of that particular list. Then you can add the

element {
  text-decoration: text-decoration: line-through;
}

I don’t know if I really understood what you meant. I now added onclick on the list and a function that changes the style of the text. But how do I undo the styling now?

Edit: I found another way to make it work, thanks for the help though!