I want to get all elements with class questions, give them an onclick and then target the specific clicked element. And in this clicked element I want to get the div with class answer-text and add class active.
My code for now:
var getQuestions = document.querySelectorAll('.questions');
 getQuestions.forEach(function(question) {
  question.addEventListener('click', function(e) {
    var target = e.target;
      var answer = target.getElementsByClassName('answer-text');
    answer.classList.add('active');
  })
 });.answer-text {
 display: none;
}
.active {
 display: block;
}
.questions {
 padding: 20px;
 font-weight: 700;
}   <div class="questions">
    <span class="icon icon-vu-arrow-top-stroke"></span><div class="question-text">
     Wat mag/kan wel en wat niet tijdens mijn uitje of vakantie?
    </div>
    <div class="answer-text">
     Antwoord 6
    </div>
   </div>
   <div class="questions">
    <span class="icon icon-vu-arrow-top-stroke"></span><div class="question-text">
     Kan ik mijn uitje wijzigen?
    </div>
    <div class="answer-text">
     Antwoord 7
    </div>
   </div>I think/know I'm really close to it working, but can't get the final step to make it work. Anyone knows how to fix this?
 
     
     
    