Prepare a page so that a script could use it.
What to build
A sign-up page with the exact ids that a script would look for, and a class that can hide things.
Requirements
- A
formwith the idsignup. - An
inputwith the idemailand the typeemail, and alabelconnected to it. - A submit
buttoninside the form. - A
pwith the idmessageandrole="status", so that screen readers announce changes to it. - A
ulwith the iditems. - A CSS rule for the class
hiddenthat removes an element from view, and at least one element using that class.
Constraints
Every id on the page must be unique. No script is needed yet.
Example
<label for="email">Email</label>
Why it works
A script can only find what has a reliable name. Separating the look into a class means that a script will later be able to hide anything with one simple change.
Hints
Hint 1
A script finds elements by id, so give each one its id exactly as listed.
Hint 2
A label's for attribute must match the input's id.
Hint 3
Write a CSS rule for .hidden, then give one element that class.
Solution
Show one correct solution (try it yourself first)
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Sign up</title>
<style>
.hidden { display: none; }
</style>
</head>
<body>
<form id="signup">
<label for="email">Email</label>
<input id="email" type="email">
<button type="submit">Send</button>
</form>
<p id="message" role="status"></p>
<ul id="items"></ul>
<p class="hidden">Thanks for signing up.</p>
</body>
</html>