there is the code html : <div class="mt-15"><div class="grid grid-cols-1 md:grid-cols-3…
- User
there is the code html : Men shoes collectionNouveau texte pour la collection de chaussures pour enfants.Shop kids nowWomen shoes collectionNouveau texte pour la collection de chaussures pour femmes.Shop women nowMen shoes collectionConstructed from luxury nylons, leathers, and custom hardware, featuring sport details such as hidden breathing vents, waterproof + antimicrobial linings, and more.Shop men now there is my code :document.addEventListener('DOMContentLoaded', function() { // Modifier le contenu du premier div var menShoesText = document.querySelector('.page-width div:nth-child(1) p'); var shopKidsLink = document.querySelector('.page-width div:nth-child(1) a');
codeif (menShoesText && shopKidsLink) { menShoesText.textContent = 'Nouveau texte pour la collection de chaussures pour enfants.'; shopKidsLink.setAttribute('href', '/new-link-for-kids'); shopKidsLink.querySelector('span').textContent = 'Shop kids now'; } // Modifier le contenu du deuxième div var womenShoesText = document.querySelector('.page-width div:nth-child(2) p'); var shopWomenLink = document.querySelector('.page-width div:nth-child(2) a'); if (womenShoesText && shopWomenLink) { womenShoesText.textContent = 'Nouveau texte pour la collection de chaussures pour femmes.'; shopWomenLink.setAttribute('href', '/new-link-for-women'); shopWomenLink.querySelector('span').textContent = 'Shop women now'; } // Modifier le contenu du troisième div var kidShoesText = document.querySelector('.page-width div:nth-child(3) p'); var shopMenLink = document.querySelector('.page-width div:nth-child(3) a'); if (kidShoesText && shopMenLink) { kidShoesText.innerHTML = 'stp.'; shopMenLink.setAttribute('href', '/new-link-for-men'); shopMenLink.querySelector('span').textContent = 'Shop men now'; }}); Why can't I change all the texts, only the first 2 childs can be changed
- Assistant