Back to Freecodecamp

Step 1

curriculum/challenges/english/blocks/workshop-piano/612e78af05201622d4bab8aa.md

latest856 B
Original Source

--description--

Create a div element within your body element with the id set to piano.

--hints--

You should create a new div element.

js
const div = document.querySelector('div');
assert.exists(div);

Your div should be within your body element.

js
const div = document.querySelector('div');
assert.equal(div?.parentElement?.localName, 'body');

Your div should have the id set to piano.

js
const div = document.querySelector('div');
assert.equal(div?.getAttribute('id'), 'piano');

--seed--

--seed-contents--

html
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <title>Piano</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  </head>
  <body>
  --fcc-editable-region--

  --fcc-editable-region--
  </body>
</html>
css