Targeting Elements on Click

I found a small "To Do List" exercise in which the user clicks on a list item and a JS function changes the background of what was clicked to a different color, using an e.target.tagName.

Now I understand there are easier ways to do this but I wanted to experiment with passing an event that a function "looks for" and then activates a particular feature but I'm a little stuck.

In my example, instead of a list, the function looks for a P element. I can get the following to work if I search for e.target.tagName == "P", however I wanted to try looking by the ID. When I change the function to read e.target.Id === "text" however, it does not work. What am I missing?