Exercise: DOM Detective
- Navigate to the Girl Develop It site,
and open up the Dev Tools console –
Cmd
-Opt
-I
(Mac), Ctrl
-Shift
-I
(Windows)
- Use the DOM access methods we learned to find the following parts of the page. There may be multiple ways to select the same DOM node.
- Every image on the page (as a collection)
- The MailChimp form at the bottom
- The three
div
s with GDI stats (as a collection)
- The image header with the headline, "DON'T BE SHY DEVELOP IT"
- The navigation menu at the top
- The GDI logo in the upper-left
- The media logos (TED, lifehacker, etc.) at the bottom (as a collection)
- All the red dots on the US map (as a collection)
Bonus: Find another element (or collection of elements), and challenge a classmate to find it in the DOM.
document.getElementsByTagName("img");
document.getElementById("mc_embed_signup");
document.getElementsByClassName("stats");
document.getElementsByClassName("opener")[0];
document.querySelector(".navigation");
document.querySelector(".logo img");
document.querySelectorAll(".press-logos img");
document.querySelectorAll("circle");