-3

Here is a my HTML and JS which are problematic the problem is that the change between the id education and experience does not work i he return me an error with the querySelector

const tabsContainer = document.querySelector(".about-tabs"),
aboutSection = document.querySelector(".about-section");

tabsContainer.addEventListener("click", (e) => {
  if (e.target.classList.contains("tab-item") && !e.target.classList.contains("active")) {
    tabsContainer.querySelector(".active").classList.remove("active");
    e.target.classList.add("active");
    const target = e.target.getAttribute("data-target");
    aboutSection.querySelector(".tab-content.active").classList.remove("active");
    aboutSection.querySelector(target).classList.add("active");
  }
});
 <div class="tab-content active " id="education">
                <div class="timeline">
                  <div class="timeline-item">
                  </div>
                  <div class="timeline-item">
                  </div>
                </div>
              </div>

              <div class="tab-content" id="experience">
                <div class="timeline">
                  <div class="timeline-item">
                  </div>
                  <div class="timeline-item">
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </section>
    </div>
  <script src="js/script.js"></script>
AlexPoug
  • 1
  • 1

0 Answers0