noobie here. I've been coding a to-do list and can't figure out how to get it to recognize the listBtn button which appears with each new list item. As I understand it, the button is undefined because it doesn't exist initially. I've tried to accommodate this with the if statement if (listBtn !== null || listBtn !== undefined), but it still isn't working. Can you help? The offending code is below:
https://codepen.io/david-webb/pen/qBbxVov
if (listBtn !== null || listBtn !== undefined) {
document.querySelector(".listBtn").addEventListener("click", function(){
let elem = document.getElementById('myUL');
console.log(elem);
elem.parentNode.removeChild(elem);
});
}