function select() {
document.querySelector();
}
const modal = select('.modal');
modal.add.....
Why can’t I addEventListener for modal?
I try to change ‘querySelectorAll’ ,but it doesn’t work
function select() {
document.querySelector();
}
const modal = select('.modal');
modal.add.....
Why can’t I addEventListener for modal?
I try to change ‘querySelectorAll’ ,but it doesn’t work
2
Answers
You don’t pass the query argument and you don’t return the element
It isn’t clear what you are selecting here. You are using a function called select and passing the argument ‘.modal’ but your function is not accepting any of parameters.
So, the code must be