Skip to content

Instantly share code, notes, and snippets.

@cferdinandi
Created January 16, 2019 19:36
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cferdinandi/3f90b47bf442512d555211c38ff8e569 to your computer and use it in GitHub Desktop.
Save cferdinandi/3f90b47bf442512d555211c38ff8e569 to your computer and use it in GitHub Desktop.
Show-and-hide project template from https://learnvanillajs.com

Project Details

Write a script that can be used to show/hide content (like the #pirate-speak element in the template) when users click a button.

Considerations

  • Should the button be part of the initial markup, or created with JavaScript?
  • How would someone using a screen reader know what content goes with the button?

Need help?

This project is part of the DOM Manipulation pocket guide and video course.

<!DOCTYPE html>
<html>
<head>
<title>Project Template</title>
<style type="text/css">
body {
margin-left: auto;
margin-right: auto;
max-width: 40em;
width: 88%;
}
</style>
</head>
<body>
<div id="pirate-speak">
Hands Letter of Marque chantey man-of-war spanker. Barbary Coast take a caulk rutters cog line. Splice the main brace chantey port parrel careen.
</div>
<script>
// Project code...
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment