0
My goal is: when clicking on the div "job-card", the respective "job-resume" should appear, but returns me the error "Uncaught Typeerror: Cannot read Property 'classList' of Undefined at Htmldivelement.".
I don’t know where the bug is, can you take a look? Thank you.
let jobCard = document.querySelectorAll('.job-card');
let jobResume = document.querySelectorAll('job-resume');
for(i = 0; i < jobCard.length;i++) {
jobCard[i].addEventListener('click', function(){
this.classList.add('job-card-active');
jobResume[i].classList.add('d-block');
});
}
your
job-card
is what exactly ? tagname ? id? than I saw in your codedocument.querySelectorAll('.job-card');
has the . job-card before or this is the search for a class?– ScrapBench
On that line Let
jobResume = document.querySelectorAll('job-resume');
not missing a point on the dial('.job-resume')
?– Augusto Vasques