attaching an eventListener to a button that will appear when clicking another button?

so basically, I’m working on a to-do list and you have to enter a task with the button ‘enter’ then the task appears in the UI with a button called ‘delete’.

I have trouble attaching event listener to the delete button.

HTML:

<div id="container">

    <input type="checkbox" id="checkbox" name="task1"  >
    <label for="task1" id="tasks">running 10 mile</label><br>
    <button id="delete">Delete</button>
    
</div>

That’s the default one .

36 thoughts on “attaching an eventListener to a button that will appear when clicking another button?”

Leave a Comment