Created
April 17, 2024 10:06
-
-
Save mcnaveen/8558f55eccbc7696049b7f813746b06e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const colorTableBody = document.querySelector('.color-table__body'); | |
if (colorTableBody) { | |
const rows = colorTableBody.querySelectorAll('tr'); | |
const colorNames = []; | |
rows.forEach(row => { | |
const colorNameElement = row.querySelector('.color-table__cell.color-table__cell--name'); | |
if (colorNameElement) { | |
const colorName = colorNameElement.innerText; | |
colorNames.push(colorName); | |
} | |
}); | |
console.log(colorNames); | |
} else { | |
console.error('Element with class "color-table__body" not found.'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment