mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2025-12-22 03:26:02 -05:00
1.7 KiB
1.7 KiB
id, title, challengeType, dashedName
| id | title | challengeType | dashedName |
|---|---|---|---|
| 642df32c0c2db433d8b46d46 | Step 5 | 0 | step-5 |
--description--
Finally, use the .appendChild() method to add your label element to the container element.
--hints--
You should access the .appendChild() method of the container element.
assert.match(code, /container\.appendChild\(/);
You should pass your label element to the .appendChild() method.
assert.match(code, /container\.appendChild\(\s*label\s*\)/);
You should append label after setting the attributes.
assert.match(code, /const\s+label\s*=\s*document\.createElement\(\s*('|"|`)div\1\s*\)\s*;?\s*label\.className\s*=\s*('|"|`)label\2\s*;?\s*label\.textContent\s*=\s*name\s*;?\s*container\.appendChild\(\s*label\s*\)/);
--seed--
--seed-contents--
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="./styles.css" />
<title>Functional Programming Spreadsheet</title>
</head>
<body>
<div id="container">
<div></div>
</div>
<script src="./script.js"></script>
</body>
</html>
#container {
display: grid;
grid-template-columns: 50px repeat(10, 200px);
grid-template-rows: repeat(11, 30px);
}
.label {
background-color: lightgray;
text-align: center;
vertical-align: middle;
line-height: 30px;
}
--fcc-editable-region--
window.onload = () => {
const container = document.getElementById("container");
const createLabel = (name) => {
const label = document.createElement("div");
label.className = "label";
label.textContent = name;
}
}
--fcc-editable-region--