Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mcnaveen/8558f55eccbc7696049b7f813746b06e to your computer and use it in GitHub Desktop.
Save mcnaveen/8558f55eccbc7696049b7f813746b06e to your computer and use it in GitHub Desktop.
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