scripts/license-osm/script.js

19 lines
628 B
JavaScript

let tab_choices = document.querySelectorAll('.tab-choice')
let tabs_content = document.querySelectorAll('.tab-item')
console.log('tab_choices', tab_choices)
tab_choices.forEach(element => {
element.addEventListener('click', (event) => {
console.log('clicked', event)
let attribut = element.getAttribute('data-activate-tab')
console.log('tab_choices', tab_choices)
tabs_content.forEach(element => {
element.classList.remove('active')
})
tab_choices.forEach(element => {
element.classList.remove('active')
})
element.classList.add('active')
document.querySelector(attribut).classList.add('active')
})
})