-
-
Save luboskmetko/d8f7f1129ed5cb73ca6ed39857c5e9ea to your computer and use it in GitHub Desktop.
let el = document.querySelector('.nav');
el.classList.add('is-open');
const children = el.querySelectorAll('li');
const textContents = Array.from(children).map(child => child.textContent);
console.log(textContents); // Logs an array of text contents from
let el = document.querySelector('.nav');
el.classList.add('is-open');
const children = el.querySelectorAll('li');
const textContents = Array.from(children).map(child => child.textContent);
console.log(textContents);
let el = document.querySelector('.nav');
el.classList.add('is-open');
const children = el.querySelectorAll('li');
const textContents = Array.from(children).map(child => child.textContent);
console.log(textContents);
document.addEventListener('DOMContentLoaded', function() {
const el = document.querySelector('.nav');
if (el) {
el.classList.add('is-open');
const children = Array.from(el.querySelectorAll('li'));
const textContents = children.map(child => child.textContent);
console.log(textContents);
} else {
console.error("Element with class 'nav' not found");
}
});
document.addEventListener('DOMContentLoaded', function() {
let el = document.querySelector('.nav');
});