Skip to content

Instantly share code, notes, and snippets.

@YasirGaji
Created December 12, 2021 14:10
Show Gist options
  • Save YasirGaji/4172054e7836478143c8e5bd003dec2c to your computer and use it in GitHub Desktop.
Save YasirGaji/4172054e7836478143c8e5bd003dec2c to your computer and use it in GitHub Desktop.
This gist showcases specific children element's children selection manipulation its further explained in the DOD article by Yasir Gaji
let val; // initilizing alpha variable
const list = document.querySelector('ul.showcase'); // assigning sub variable "list" to the ul in the html collection
val = list.children[1].children[0]; // HERE WE ARE SELECTING THE FIRST CHILD OF THE SECOND CHILD IN THE "list" AND ASSIGNING IT TO "val"
val.style.color = 'red'; // here we manipulate and change "val"'s color
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment