Skip to content

Instantly share code, notes, and snippets.

@auremoser
Last active November 22, 2016 20:22
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 auremoser/24668d6f0918436cc01f15619e620a4c to your computer and use it in GitHub Desktop.
Save auremoser/24668d6f0918436cc01f15619e620a4c to your computer and use it in GitHub Desktop.
DOM Access
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery: DOM access</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<link href="http://www.teaching-materials.org/common/bootstrap.css" rel="stylesheet">
</head>
<body>
<div class="container">
<h2>jQuery: DOM access</h2>
<h3>The DOM Detective</h3>
<ul>
<li>Open up <a href="http://www.girldevelopit.com">girldevelopit.com</a> in Chrome or Firefox,
and open up the console (CMD-Option-I on Macs).
<li>Use jQuery to find the following parts of the page. You probably first want to use Inspect Element to figure out what their tag names, classes, and IDs are.</li>
<ol>
<li>Every image on the page</li>
<li>The navigation area in the upper right</li>
<li>The MailChimp sign-up form in the bottom</li>
<li>The upper left-hand logo that says GDI (Hint: use CSS descendant selectors)</li>
<li>The logos of the media sources that featured Girl Develop It (lifeHacker, TED, etc., at the bottom of the page)</li>
<li>The big heading that says "DON'T BE SHY DEVELOP IT"</li>
<li>BONUS: all the dots in the map</li>
</ol>
</ul>
<button onclick="showSolution(1)" class="btn">See Solution</button>
<br><br>
<pre id="solution1" style="display:none;">
$("img");
$(".nav");
$("#mc_embed_signup");
$(".logo img");
$(".press-logos img");
$(".opener h1");
$("circle");
</pre>
<br><br><br><br><br>
<script>
function showSolution(num) {
if (confirm('You surrrrre?')) {
document.getElementById('solution' + num).style.display = 'block';
}
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment